A JavaScript Framework for Building Brilliant Applications

Overview

mithril.js npm Version npm License npm Downloads Donate at OpenCollective

Build Status Gitter

What is Mithril?

A modern client-side JavaScript framework for building Single Page Applications. It's small (9.79 KB gzipped), fast and provides routing and XHR utilities out of the box.

Mithril is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍 .

Mithril supports IE11, Firefox ESR, and the last two versions of Firefox, Edge, Safari, and Chrome. No polyfills required. 👌

Installation

CDN

<!-- Development: whichever you prefer -->
<script src="https://unpkg.com/mithril/mithril.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mithril/mithril.js"></script>

<!-- Production: whichever you prefer -->
<script src="https://unpkg.com/mithril/mithril.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mithril/mithril.min.js"></script>

npm

npm install mithril --save

The "Getting started" guide is a good place to start learning how to use mithril.

TypeScript type definitions are available from DefinitelyTyped. They can be installed with:

$ npm install @types/mithril --save-dev

Documentation

Documentation lives on mithril.js.org.

You may be interested in the API Docs, a Simple Application, or perhaps some Examples.

Getting Help

Mithril has an active & welcoming community on Gitter, or feel free to ask questions on Stack Overflow using the mithril.js tag.

Contributing

There's a Contributing FAQ on the mithril site that hopefully helps, but if not definitely hop into the Gitter Room and ask away!


Thanks for reading!

🎁

Comments
  • Reusable components.

    Reusable components.

    Hi,

    What about creating a repo which contains a set of reusable UI components? something like Angular-UI or Khan Acacdemy

    I am ready to contribute.

    Cheers!

    Type: Question 
    opened by vivekimsit 225
  • Rename

    Rename "controller"

    My thinking is that "controller" is not sufficiently agnostic; the word comes with MVC baggage, yet it's use is very flexible source

    It's not that the view context can't serve as a controller, nor that it shouldn't if you choose to use MVC, but that it shouldn't be inferred to be limited to that concept by it's name. source

    Suggestions: scope, context, viewContext, viewctx, state, viewstate

    Counter arguments:

    While a controller can do many other things I think the MVC "baggage" is useful as it's a shared term with an understood meaning that gets the point across. Just because you can use it in other ways doesn't negate the fact that calling it a controller identifies the basic utility of it in a quick way that doesn't force you to learn a new term source

    Why the word "controller" is wrong? "Controllers contain the interface between their associated models and views and the input devices (keyboard, pointing device, time). Controllers also deal with scheduling interactions with other view-controller pairs: they track mouse movement between application views, and implement messages for mouse button activity and input from the input sensor. Although menus can be thought of as view-controller pairs, they are more typically considered input devices, and therefore are in the realm of controllers." This is what the controller of mithril is doing right now. Mithril is one of the few frameworks that i really believe is using the MVC pattern correctly. source

    Type: Breaking Change 
    opened by gilbert 113
  • Add hook to router

    Add hook to router

    A feature request for the Mithril rewrite:

    I love the simplicity of the current router, but I would like to expose a hook that runs after a route has been resolved but before the associated component has been rendered. The feature would be useful for implementing a few common patterns:

    • / routes to a landing page if the user is logged out, but /dashboard if the user is logged in
    • /dashboard routes to a dashboard if user is logged in, but /login if user is logged out

    There is lots of precedent for this type of hook in other routers. See, for example, onenter in react-router and the ability to extend router.execute in Backbone.

    Current solution in Mithril
    var Dashboard = {
      oninit: function(vnode) {
          if (!Auth.loggedIn()) {
            m.route.setPath("/login");
          }
      }
    // *** view code ***
    }
    

    Unfortunately, since setPath asynchronously triggers a reroute only after the window.onpopstate event fires, the dashboard component above renders to the screen for a split second before the login page is loaded.

    Propsed API Options

    Add an onroute hook to components that runs before the component is rendered and has the option to redirect to another route without rendering the component?

    Alternatively, if oninit returns false, prevent rendering of the component?

    opened by s3ththompson 107
  • Mithril redesign

    Mithril redesign

    A fork of issue Reasons we use Mithril #1026

    Here we can propose our approaches to Mithril's logo, slogan/tagline, or site design (freeware only)

    Reason: Mithril's community is lacking. A redesign in parallel to a rewrite can promote growth to the mithril community with a well-defined purpose.

    opened by aardno 98
  • Components don't work with ES6 classes.

    Components don't work with ES6 classes.

    Since ES6 classes need to be called with new and this needs to be an instance of the class, components will not work with a class. The issue stems from here: https://github.com/lhorie/mithril.js/blob/next/mithril.js#L554

    Example (using babel-compiled class): https://jsfiddle.net/1prjtv78/

    A work around is to wrap the component controller like:

    var Component = {
       controller: function () { return new ComponentController(...arguments); }.
       view: View
    };
    

    Which transpiles to something equally ugly:

    var _bind = Function.prototype.bind;
    var Component = {
       controller: function () { return new (_bind.apply(ComponentController, [null].concat(arguments)))(); }.
       view: View
    };
    

    Example of working: https://jsfiddle.net/1prjtv78/1/

    Perhaps the parametize.controller function can do something similar to the transpiled code.

    Legacy: v0.2 
    opened by Naddiseo 72
  • [rewrite] Rest of the API

    [rewrite] Rest of the API

    Since we're starting to get to that point, I think it's a good idea to start thinking of the rest of the high-level API. Here's some of my ideas:

    • Mithril.m(type, attrs?, ...children)

      The familiar m() hyperscript API.

    • var trust = Mithril.trust

    • var mountpoint = Mithril.mount(window = global.window)

      Ideally, this should return an object you can use to do m.redraw()-like things and have multiple independent roots. The argument is for easy mocking, and effectively nullifies m.deps.

    • mountpoint.window

      This is the window value argument passed to Mithril.mount(), defaulting to the global window. You can also use a JSDOM window if you want to use it in Node.

    • var promise = mountpoint.redraw()

      This should do the equivalent of 0.2's async m.redraw(), but return a Promise.

    • mountpoint.redrawSync()

      This should do the equivalent of 0.2's sync m.redraw(true), and return nothing.

    • mountpoint.redrawStrategy = "all" | "diff" | "none"

      This fufulls the same purpose as m.redraw.strategy(). It might not be necessary with the lifecycle methods, though.

    • var promise = mountpoint.compute(callback: () => Promise | void)

      This should take the place of m.startComputation and m.endComputation. It is roughly equivalent to the following code:

      m.startComputation()
      return Promise.resolve(callback()).then(() => {
          m.endComputation()
      })
      
    • Mithril.prop(init?, observer?)

      m.prop is popular enough that it should probably stay in core. I do believe it should lose the Promise absorbing semantics, though, and it should be optionally observable.

    • Mithril.withAttr(value, callback, thisArg)

      m.withAttr also seems popular enough that it could remain in core, with few modifications (mostly removing compat bloat).


    The rest are generally not necessary/needed in the core distribution.

    • m.route can be implemented on top of m.mount in a third-party module.
    • m.component can (and should) die.
    • m.request should be go away in favor of the native Fetch API, and there is an XHR-based polyfill if you need one. IMHO, redraw after request should be explicit, anyways.
    • m.deferred and m.sync should go away in favor of native Promises. If necessary, there's a ton of libraries and polyfills for that.

    /cc @tivac @lhorie

    opened by dead-claudia 63
  • Make latest attrs available to event callbacks

    Make latest attrs available to event callbacks

    I really like Inferno's linkEvent(...) helper function (see doc), and I'm hoping that others also have interest in seeing a similar function get added to mithril.

    It just feels bad/strange to have to recreate anonymous/arrow functions (or use function binding) to enable passing data from a component to event callbacks. Adding first-class support for a utility function like this provides an alternative that some may find cleaner. As a bonus, the Inferno doc claims a performance boost from this approach. I haven't verified the performance difference, but given the nature of closures and function binding, it makes sense.

    Given the mithril doc's recommendation to "avoid fat components", a utility function like this seems like a natural fit since it helps to enable keeping state manipulation code separate from components. How about adding a similar helper function to mithril? Is there any interest? If so, I'd be happy to start working on it.

    Type: Enhancement 
    opened by bdpartridge 61
  • Reasons we use Mithril

    Reasons we use Mithril

    Hey everyone!

    It would be very helpful if everyone could say 1 or 2 words that summarise why they use Mithril instead of another MVC library.

    If anyone and everyone involved in Mithril could just say in 1 word why they use mithril instead of another library. Hopefully we could aggregate and come up with a clear message to help with a redesign of the site. We are all here for a reason, the task is to make our reasons concise and precise.

    Type: Meta/Feedback 
    opened by JAForbes 61
  • Making Mithril modular

    Making Mithril modular

    This implements the proposal in #651.

    Summary

    This is a fairly extensive PR, modifying Mithril to use a package ecosystem. CommonJS-style (for node compatibility) packages together with Webpack (smallest footprint) are used.

    Structure

    The following folder structure is used:

    |-- mithril.js
        |-- src
            |-- index.js
            |-- core
            |   |-- fns.js
            |   |-- init.js
            |   |-- types.js
            |-- helpers
            |   |-- Object.assign.js
            |-- modules
                |-- DOM.js
                |-- http.js
                |-- mock.js
                |-- router.js
                |-- utils.js
    

    core includes packages that are used across all modules. Object.assign polyfill is used to combine modules in index.js, which is the entry point. More entry points can be configured in webpack's configuration and built/tested individually.

    Benefits

    1. Mithril as a library can now import modules to for usage within the library.
    2. Specialized builds of Mithril can be made.
      • A separate file for each built can be made, for example: mithril.js, mithril.DOM.js,mithril.router.js` etc.
      • Module ecosystems can use var m = require('mithril/DOM') once a build for npm is set up.
    3. Modules allow for a more organized codebase which is easy to reason about, refactor, and add to.

    Changes List

    In addition to the restructuring, the following changes to the code base were made:

    1. several functions have been extracted to their own modules, and as such, calling them requires namespacing (fns.propify() etc.).

    2. I've added this line to redraw:

      var raf = $.requestAnimationFrame, caf = $.cancelAnimationFrame;
      

      $ is where initialize is defined, and when we require it $document becomes $.document. The above functions can't be called like that it would seem, requiring the assignment. Not sure if this is the best solution.

    3. Tests for console.log and document.write presence have been removed since we don't have a global IIFE anymore. Another method can be used.

    4. Gruntfile.js was changed to accommodate webpack.

    5. for testing, m.deps is now in mock.js. index.js has this line:

      if (typeof global != "undefined") global.m = m;
      

      and in tests/mithril-tests.js:

        var m = global.m;
      

      Since the tests and the script's output object are no longer in the same scope.

    The cost

    Is a few more milliseconds of loading and evaluating the script, as well as ~2kb of minified script size.

    opened by srolel 56
  • enhancement: class attr should accept an object

    enhancement: class attr should accept an object

    It should just loop the keys, and join them by a space if their value is truthy.

    So then instead of this

    class: (function () {
        var classes = '';
        classes += task.completed() ? 'completed' : '';
        classes += task.editing() ? ' editing' : '';
        return classes;
    })()
    

    We can just write this

    class: {completed: task.completed(), editing: task.editing()}
    
    opened by farzher 56
  • Make a first-class way for event handlers to be run without auto-redrawing.

    Make a first-class way for event handlers to be run without auto-redrawing.

    Allow a noredraw object for event handlers which aren't wrapped in redrawing, or iterate config applying any onxxx attributes in the same way.

    Event handling is sufficiently tightly bound to a component that avoiding use of config is preferable, since, ideally, config should be reserved for unusual use-cases, not common ones.

    Modify setAttributes to add the following code to the if/else setting attributes:

    //handle `noredraw: {...}`
    else if (attrName === "noredraw" && dataAttr != null && type.call(dataAttr) == OBJECT) {
        for (var rule in dataAttr) {
            node[attrName] = dataAttr[rule];
        }
    }
    
    Type: Bug 
    opened by lawrence-dol 51
  • Some boolean attributes/properties with weird behavior

    Some boolean attributes/properties with weird behavior

    Edit: The original title was "Rendering m([spellcheck=false]) results in <div spellcheck="true">", but there are more issues, see below.

    As mentioned in #2386 by @anonghuser, m([spellcheck=false]) results in <div spellcheck="true">, it should obviously be false.

    I don't know if this should be fixed though. In scenarios where you want it not set, statically, you can omit the attribute. For dynamic scenarios the attrs object is a better method.

    Type: Bug 
    opened by pygy 6
  • Bump qs from 6.5.2 to 6.5.3

    Bump qs from 6.5.2 to 6.5.3

    Bumps qs from 6.5.2 to 6.5.3.

    Changelog

    Sourced from qs's changelog.

    6.5.3

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] utils.merge`: avoid a crash with a null target and a truthy non-array source
    • [Fix] correctly parse nested arrays
    • [Fix] stringify: fix a crash with strictNullHandling and a custom filter/serializeDate (#279)
    • [Fix] utils: merge: fix crash when source is a truthy primitive & no options are provided
    • [Fix] when parseArrays is false, properly handle keys ending in []
    • [Fix] fix for an impossible situation: when the formatter is called with a non-string value
    • [Fix] utils.merge: avoid a crash with a null target and an array source
    • [Refactor] utils: reduce observable [[Get]]s
    • [Refactor] use cached Array.isArray
    • [Refactor] stringify: Avoid arr = arr.concat(...), push to the existing instance (#269)
    • [Refactor] parse: only need to reassign the var once
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [readme] remove travis badge; add github actions/codecov badges; update URLs
    • [Docs] Clean up license text so it’s properly detected as BSD-3-Clause
    • [Docs] Clarify the need for "arrayLimit" option
    • [meta] fix README.md (#399)
    • [meta] add FUNDING.yml
    • [actions] backport actions from main
    • [Tests] always use String(x) over x.toString()
    • [Tests] remove nonexistent tape option
    • [Dev Deps] backport from main
    Commits
    • 298bfa5 v6.5.3
    • ed0f5dc [Fix] parse: ignore __proto__ keys (#428)
    • 691e739 [Robustness] stringify: avoid relying on a global undefined (#427)
    • 1072d57 [readme] remove travis badge; add github actions/codecov badges; update URLs
    • 12ac1c4 [meta] fix README.md (#399)
    • 0338716 [actions] backport actions from main
    • 5639c20 Clean up license text so it’s properly detected as BSD-3-Clause
    • 51b8a0b add FUNDING.yml
    • 45f6759 [Fix] fix for an impossible situation: when the formatter is called with a no...
    • f814a7f [Dev Deps] backport from main
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once CI passes on it, as requested by @dead-claudia.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies patch 
    opened by dependabot[bot] 2
  • Clarify a couple of pitfalls I landed in

    Clarify a couple of pitfalls I landed in

    Description

    Non-functional doc changes that clarify a couple of pitfalls I fell into while learning mithril. Trying to use a class instance as a component rather than the class itself leads weirdness as mithril ends up using the object instance as a prototype for a new object with shadowed properties.

    With single keyed fragments I missed the point about keying the child rather than the shared parent object and took a while to realize my mistake. Maybe there's a better explanation for why it's that wya.

    Motivation and Context

    Save time and simplify the learning curve.

    How Has This Been Tested?

    Doc.

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)
    • [x] Documentation change

    Checklist:

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [] I have added tests to cover my changes.
    • [ ] All new and existing tests passed.
    • [ ] I have updated docs/changelog.md
    opened by patricksurry 0
  • Add Ref Feature

    Add Ref Feature

    Description

    Add the ref attribute. When vnode contains the ref attribute, vnode assigns its refrence to ref.current when it is created. This is similar to ref in react.

    Motivation and Context

    This makes it easy for developers to get a specific vnode refrence when using chain method to create the vnode tree. For example:

    function HomePage() {
      const inputRef = m.ref();
      const handleClick = () => {
        console.log(inputRef.current.dom.value);
      };
      return {
        view: () =>
          m('div', [m('input', { placeholder: 'name', ref: inputRef }), m('button', { onclick: handleClick }, 'OK')]),
      };
    }
    m.mount(document.body, HomePage);
    

    How Has This Been Tested?

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)
    • [ ] Documentation change

    Checklist:

    • [x] My code follows the code style of this project.
    • [x] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    • [ ] I have updated docs/changelog.md
    opened by clysto 5
  • stringifying xhr error response

    stringifying xhr error response

    When an XHR error response is returned with responseType set to 'json' the error reponse is not handled correctly.

    Description

    When the responseText is type JSON the response is still assigned to the new Error which is expecting a string.

    Motivation and Context

    This PR is an attempt to address https://github.com/MithrilJS/mithril.js/issues/2802

    How Has This Been Tested?

    I ran yarn test request/tests/test-request.js I saw a bunch of warnings and errors that were unrelated I believe.

    Types of changes

    • [ x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)
    • [ ] Documentation change

    Checklist:

    • [ x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [ x] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [x ] All new and existing tests passed.
    • [ ] I have updated docs/changelog.md
    opened by boazblake 1
Releases(v2.2.2)
  • v2.2.2(May 25, 2022)

  • v2.2.1(May 24, 2022)

  • v2.2.0(May 16, 2022)

    Release v2.2.0

    • #2769
    • #2752
    • #2768
    • #2578
    • #2722
    • #2316
    • #2750
    • #2711
    • #2743
    • #2670
    • #2695
    • #2641
    • #2655
    • #2537
    • #2646
    • #2633
    • #2594
    • #2603
    • #2539
    • #2536
    • #2405
    • #2744
    • #2765
    • #2760
    • #2758
    • #2751
    • #2757
    • #2748
    • #2745
    • #2620
    • #2644
    • #2649
    • #1767
    • #2718
    • #2693
    • #2741
    • #2651
    • #2721
    • #2353
    • #2206
    • #2648
    • #2672
    • #2717
    • #2348
    • #2698
    • #2696
    • #2684
    • #2680
    • #2679
    • #2673
    • #2674
    • #2657
    • #2639
    • #2487
    • #2585
    • #2630
    • #2629
    • #2628
    • #2627
    • #2608
    • #2605
    • #2593
    • #2582
    • #2576
    • #2573
    • #2567
    • #2561
    • #2553
    • #2540
    • #2538
    • #2522
    • #2513

    Changelog

    Minor Changes

    m.censor: work around a bunder bug (@kfule)

    The internal bundler sometimes mangles the words in RegExp literals incorrectly. Please see below.

    Warn about reusing mutated attrs object - fixes #2719 (@StephanHoyer)

    Send URLSearchParams as request body without extra configuration (@Coteh)

    This PR fixes an oddity I noticed in the way m.request handles URLSearchParams object. It now handles it in the same sort of way XHR and Fetch do it.

    Add params: to m.route.Link, fix docs (@dead-claudia)

    Add params: to m.route.Link. Minor fix to docs to reflect reality with m.route.Link's disabled: attribute.

    Allow Mithril to be loaded in non-browser environments without modification (@dead-claudia)

    Recast the global reads to all be guarded with typeof, so that if they aren't defined, they're just null.

    Add a m.Fragment = "[" utility for JSX users. (@dead-claudia)

    The title says it all, and the diff's obvious. Resolves https://github.com/MithrilJS/mithril.js/issues/2640 and probably others.

    Patch Changes

    Enable --minimize-semver-change for pr-release (@JAForbes)

    Minimizes semver changes on release to the minimum required version bump to satisfy major/minor/patch semver ranges. Minimizes the semver change so that.

    Clean up m.route.Link (@barneycarroll)

    An attempt at better demonstrating m.route.Link with less text. Fixes #2767.

    Runtime-deprecate ospec, change change-log to changelog, fix a few assorted bugs (@dead-claudia)

    This PR is in two parts: 1. Revise the build system and some of the local dev setup. Fully split ospec from the repo, and add it as a dependency.

    Add meta description to docs (@StephanHoyer)

    rework of #2149. added a meta description parser and meta descriptions to all docs pages. because google. built the docs, inspected the output manually.

    Fixed badges, consistent naming of Mithril.js (@tbreuss)

    use consistent naming of Mithril.js. fix badges in README. Fixes issue #2749.

    Catch malformed URI Components (@jdiderik)

    Fix for error thrown when a value contains non-valid / malformed URI Component. Example: test=%c5%a1%e8ZM%80%82H. will throw "URI malformed".

    Correctly handle invalid escapes in routes based on 0a5ead31c9fbd7b153c521c7f9d3df7bf826ce6c (@StephanHoyer)

    fixes #2061. @dead-claudia I just redid your change but slightly different in order to handle a mix of wrong and right encodings properly.

    Standardise vnode text representation (@barneycarroll)

    This addresses the crucial feature of #2669: text is always represented as virtual text nodes, never as a vnode.text.

    Issue 2624 no content 204 parse (@Evoke-PHP)

    Added guard so that JSON.parse does not fail on IE11 with no content empty string being parsed. Fixes https://github.com/MithrilJS/mithril.js/issues/2624.

    [m.request] work around a bundler bug, fix #2647 (@pygy)

    The bundler mangles identifier-like strings within RegExps, this works around the problem by not using such RegExps.

    Reject request on XHR timeout (@kevinfiol)

    Derived from PR #2581. Allows requests to properly reject on event of a timeout.

    Remove extra isLifecycleMethod call from removeAttr (@ZeikJT)

    Removing an extra isLifecycleMethod in the removeAttr method, it isn't needed since it's already checked on the previous line.

    Fix #2601 (@dead-claudia)

    Fix issue where ending a stream in the middle of a stream callback would result in erroneous parent stream state for the rest of that emit. Fixes #2601.

    Add streams to releases again, include minified bundle, drop internal stuff from npm (@dead-claudia)

    Add stream/stream.js to releases again. Add stream/stream.min.js now that the process is remotely sane now.

    Make errors and their messages more accurate and helpful (@dead-claudia)

    I updated error messages to be much more helpful.

    Fix assertion descriptions (@soulofmischief)

    I moved the return statement to the end of define() so that it returns even if the comparison fails.

    Fix branch target (@dead-claudia)

    https://github.com/MithrilJS/mithril.js/runs/6199543939?check_suite_focus=true.

    Automate mithril's release workflow (@JAForbes)

    Automated releases, pre-releases, (code) rollbacks and recovery, npm publishing, change log management just by using normal github flow.

    rework jsx docs (@StephanHoyer)

    Add Simple Application Flems Supporting v2.0.4 and up (@tbreuss)

    Added Flems for Simple Application supporting v2.0.4 of Mithril.js. Fixes Issue #2710.

    Make example work with webpack v5.69.1 (@StephanHoyer)

    fixes #2634.

    2604: correct and move text about statements in view method (@kevinfiol)

    Addresses #2604.

    Fix lint errors (@StephanHoyer)

    WIP: Update modularisation details in Installation docs (@orbitbot)

    added link to flems.io as an easier way to just try out the framework. -. Documentation has grown a bit stale.

    Added power support for the travis.yml file with ppc64le (@sreekanth370)

    Added power support for the travis.yml file with ppc64le. This is part of the Ubuntu distribution for ppc64le.

    Updated babel/webpack docs to work with latest versions (@pereriksson)

    As a developer I tried setting up Mithril with Babel and Webpack but failed because of a variety of errors.

    [docs] route redirection using the history API (@pygy)

    This is an attempt at fixing #1759, but there may be more to be added. Feedback welcome. ping @dontwork.

    Bump path-parse from 1.0.6 to 1.0.7 (@dependabot[bot])

    Bumps path-parse from 1.0.6 to 1.0.7. Commits. See full diff in compare view.

    Bump glob-parent from 5.1.0 to 5.1.2 (@dependabot[bot])

    Bumps glob-parent from 5.1.0 to 5.1.2. Release notes. Sourced from glob-parent's releases. v5.1.2. Bug Fixes.

    Bump ajv from 6.10.2 to 6.12.6 (@dependabot[bot])

    Bumps ajv from 6.10.2 to 6.12.6. Release notes. Sourced from ajv's releases. v6.12.6. Fix performance issue of "url" format.

    Update standalone usage (@ghost)

    Avoid double encoding of function signatures - fixes #2720 (@StephanHoyer)

    Show previous versions (@mike-ward)

    Add Dropdown that shows links to archived versions of the documentation.

    docs: improve m.request return value description (@GAumala)

    In the m.request return value description, add a line informing that error status codes cause the promise to reject.

    A note on JSX events (@pereriksson)

    Naming JSX events according to their documentation produces unexpected results with incorrectly named events when using JSX with Mithril.

    Document route resolution cancellation, fixes #1759 (@barneycarroll)

    Also fixes a broken internal link.

    Bump marked from 0.7.0 to 4.0.10 (@dependabot[bot])

    Bumps marked from 0.7.0 to 4.0.10. Release notes. Sourced from marked's releases. v4.0.10. 4.0.10 (2022-01-13). Bug Fixes.

    Flems in docs (#2348) [skip ci] (@porsager)

    Added flems instead of the current codepen samples.

    Remove old TOC link (@ArthurClemens)

    Content was moved some time ago and linked section no longer exists.

    Cavemansspa patch 1 (@cavemansspa)

    Documentation update.

    Bump hosted-git-info from 2.8.4 to 2.8.9 (@dependabot[bot])

    Bumps hosted-git-info from 2.8.4 to 2.8.9. Changelog. Sourced from hosted-git-info's changelog. 2.8.9 (2021-04-07).

    Bump lodash from 4.17.20 to 4.17.21 (@dependabot[bot])

    Bumps lodash from 4.17.20 to 4.17.21. Commits. f299b52 Bump to v4.17.21.

    Bump handlebars from 4.7.6 to 4.7.7 (@dependabot[bot])

    Bumps handlebars from 4.7.6 to 4.7.7. Changelog. Sourced from handlebars's changelog. v4.7.7 - February 15th, 2021.

    Remove unreachable keyed node logic, fixes #2597 (@barneycarroll)

    Delete test-utils/README.md (@dead-claudia)

    We don't expose this publicly anymore, so there's literally no justification for this file's existence.

    simple-application.md: consistent use of type=submit (@danbst)

    When following tutorial and typing everything in, I was confused that Save button didn't work.

    Fix inconsistent capitalizations of "JavaScript" (@mtsknn)

    "Javascript"/"javascript" → "JavaScript". Fixes #2398, or at least I can't find any more incorrect capitalizations.

    fix some typos (@osban)

    Found some typos. Mainly unescaped | in tables, but also a few other irregularities. Not all problems are visible in the website docs.

    Replace mocha by ospec in testing page (@gamtiq)

    Fixed a typo in testing doc page. Currently there is reference to mocha in the page whereas opsec is used.

    Bump acorn from 7.1.0 to 7.4.0 (@dependabot[bot])

    Bumps acorn from 7.1.0 to 7.4.0. Commits. 54efb62 Mark version 7.4.0.

    Bump handlebars from 4.4.2 to 4.7.6 (@dependabot[bot])

    Bumps handlebars from 4.4.2 to 4.7.6. Changelog. Sourced from handlebars's changelog. v4.7.6 - April 3rd, 2020.

    Bump lodash from 4.17.15 to 4.17.20 (@dependabot[bot])

    Bumps lodash from 4.17.15 to 4.17.20. Commits. ded9bc6 Bump to v4.17.20. 63150ef Documentation fixes.

    Bump minimist from 1.2.0 to 1.2.3 (@dependabot[bot])

    Bumps minimist from 1.2.0 to 1.2.3. Commits. 6457d74 1.2.3. 38a4d1c even more aggressive checks for protocol pollution.

    Update installation.md (@purefan)

    Offer to install mithril as a webpack plugin. Just makes my life easier by not having to include mithril in every one of my js files.

    replace slave label with replica (@stephanos)

    One of the example is using the antiquated word "slave" for a database replica. I updated the language and tested the change.

    ES6 and m.trust docs patch (@kczx3)

    While reading through some of the documentation I saw some issues with both the ES6 and m.trust pages.

    docs: Fix simple typo, subsequece -> subsequence (@timgates42)

    There is a small typo in mithril.js, render/render.js. Should read subsequence rather than subsequece.

    change link to go to ospec instead of mocha (@akessner)

    Change the link to point to ospec docs in github. ospec link went to mochajs. issue 2575. N/A. N/A. N/A.

    updated to the Vimeo showcase (@CreaturesInUnitards)

    The scrimba version of Mithril 0-60 was built on their beta platform, and doesn't really even work anymore.

    adding more community examples (@boazblake)

    Exclude archive of previous docs (@cztomsik)

    update .npmignore so that archives are not included in the resulting package. space/bandwidth savings. fix #2552.

    Pimp the docs linter (and assorted changes) (@pygy)

    Add an optional cache for faster runs. Add a final report. Don't return anything from exec(). Cover more files. Look for a "--cache" option.

    Recast key docs to be much clearer and more accurate (@dead-claudia)

    Recast key docs to be much clearer and more accurate, including a few Flems examples to help intuitively explain things.

    Add m.censor, adjust m.route.Link to use it (@dead-claudia)

    Add m.censor. Adjust m.route.Link to use it. Restructure a few things for better code reuse. Fixes #2472.

    Update fetch() browser support in docs (@qgustavor)

    As Can I use shows fetch() supported since Safari 10.1 and iOS Safari 10.3.

    docs: Add release dates to all change-log files (@maranomynet)

    I'd like to introduce release dates to the change log files. Release dates are human-friendly and add a bit of historical perspective to change-log files.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.7(Sep 23, 2019)

  • v2.0.4(Aug 18, 2019)

  • v2.0.3(Jul 28, 2019)

  • v2.0.1(Jul 24, 2019)

    This is really what v2.0.0 was supposed to be, but the npm upload got botched the first time around.

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • cast className using toString (#2309)
    • render: call attrs' hooks last, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)
    • request: data has now been split to params and body and useBody has been removed in favor of just using body. (#2361)
    • route, request: Interpolated arguments are URL-escaped (and for declared routes, URL-unescaped) automatically. If you want to use a raw route parameter, use a variadic parameter like in /asset/:path.../view. This was previously only available in m.route route definitions, but it's now usable in both that and where paths are accepted. (#2361)
    • route, request: Interpolated arguments are not appended to the query string. This means m.request({url: "/api/user/:id/get", params: {id: user.id}}) would result in a request like GET /api/user/1/get, not one like GET /api/user/1/get?id=1. If you really need it in both places, pass the same value via two separate parameters with the non-query-string parameter renamed, like in m.request({url: "/api/user/:urlID/get", params: {id: user.id, urlID: user.id}}). (#2361)
    • route, request: m.route.set, m.request, and m.jsonp all use the same path template syntax now, and vary only in how they receive their parameters. Furthermore, declared routes in m.route shares the same syntax and semantics, but acts in reverse as if via pattern matching. (#2361)
    • request: options.responseType now defaults to "json" if extract is absent, and deserialize receives the parsed response, not the raw string. If you want the old behavior, use responseType: "text". (#2335)
    • request: set Content-Type: application/json; charset=utf-8 for all XHR methods by default, provided they have a body that's != null (#2361, #2421)
      • This can cause CORS issues when issuing GET with bodies, but you can address them through configuring CORS appropriately.
      • Previously, it was only set for all non-GET methods and only when useBody: true was passed (the default), and it was always set for them. Now it's automatically omitted when no body is present, so the hole is slightly broadened.
    • route: query parameters in hash strings are no longer supported (#2448 @isiahmeadows)
      • It's technically invalid in hashes, so I'd rather push people to keep in line with spec.
    • render: validate all elements are either keyed or unkeyed, and treat null/undefined/booleans as strictly unkeyed (#2452 @isiahmeadows)
      • Gives a nice little perf boost with keyed fragments.
      • Minor, but imperceptible impact (within the margin of error) with unkeyed fragments.
      • Also makes the model a lot more consistent - all values are either keyed or unkeyed.
    • vnodes: normalize boolean children to null/undefined at the vnode level, always stringify non-object children that aren't holes (#2452 @isiahmeadows)
      • Previously, true was equivalent to "true" and false was equivalent to "".
      • Previously, numeric children weren't coerced. Now, they are.
      • Unlikely to break most components, but it could break some users.
      • This increases consistency with how booleans are handled with children, so it should be more intuitive.
    • route: key parameter for routes now only works globally for components (#2458 @isiahmeadows)
      • Previously, it worked for route resolvers, too.
      • This lets you ensure global layouts used in render still render by diff.
    • redraw: mithril/redraw now just exposes the m.redraw callback (#2458 @isiahmeadows)
      • The .schedule, .unschedule, and .render properties of the former redrawService are all removed.
      • If you want to know how to work around it, look at the call to mount in Mithril's source for m.route. That should help you in finding ways around the removed feature. (It doesn't take that much more code.)
    • api: m.version has been removed. If you really need the version for whatever reason, just read the version field of mithril/package.json directly. (#2466 @isiahmeadows)
    • route: m.route.prefix(...) is now m.route.prefix = .... (#2469 @isiahmeadows)
      • This is a fully fledged property, so you can not only write to it, but you can also read from it.
      • This aligns better with user intuition.
    • route: m.route.link function removed in favor of m.route.Link component. (#2469 @isiahmeadows)
      • An optional options object is accepted as an attribute. This was initially targeting the old m.route.link function and was transferred to this. (#1930)
      • The new component handles many more edge cases around user interaction, including accessibility.
      • Link navigation can be disabled and cancelled.
      • Link targets can be trivially changed.

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)
    • route: Declared routes may check against path names with query strings. (#2361)
    • route: Declared routes in m.route now support - and . as delimiters for path segments. This means you can have a route like "/edit/:file.:ext". (#2361)
      • Previously, this was possible to do in m.route.set, m.request, and m.jsonp, but it was wholly untested for and also undocumented.
    • API: m.buildPathname and m.parsePathname added. (#2361)
    • route: Use m.mount(root, null) to unsubscribe and clean up after a m.route(root, ...) call. (#2453)
    • render: new redraw parameter exposed any time a child event handler is used (#2458 @isiahmeadows)
    • route: m.route.SKIP can be returned from route resolvers to skip to the next route (#2469 @isiahmeadows)
    • API: Full DOM no longer required to execute require("mithril"). You just need to set the necessary globals to something, even if null or undefined, so they can be properly used. (#2469 @isiahmeadows)
      • This enables isomorphic use of m.route.Link and m.route.prefix.
      • This enables isomorphic use of m.request, provided the background: true option is set and that an XMLHttpRequest polyfill is included as necessary.
      • Note that methods requiring DOM operations will still throw errors, such as m.render(...), m.redraw(), and m.route(...).
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    • render: simplify component removal (#2214)
    • render: remove some redundancy within the component initialization code (#2213)
    • API: mithril loads mithril/index.js, not the bundle, so users of mithril/hyperscript, mithril/render, and similar see the same Mithril instance as those just using mithril itself.
      • https://unpkg.com/mithril is configured to receive the minified bundle, not the development bundle.
      • The raw bundle itself remains accessible at mithril.js, and is not browser-wrapped.
      • Note: this will increase overhead with bundlers like Webpack, Rollup, and Browserify.
    • request: autoredraw support fixed for async/await in Chrome (#2428 @isiahmeadows)
    • render: fix when attrs change with onbeforeupdate returning false, then remaining the same on next redraw (#2447 @isiahmeadows)
    • render: fix internal error when onbeforeupdate returns false and then true with new child tree (#2447 @isiahmeadows)
    • route: arbitrary prefixes are properly supported now, including odd prefixes like ?# and invalid prefixes like #foo#bar (#2448 @isiahmeadows)
    • request: correct IE workaround for response type non-support (#2449 @isiahmeadows)
    • render: correct contenteditable check to also check for contentEditable property name (#2450 @isiahmeadows)
    • docs: clarify valid key usage (#2452 @isiahmeadows)
    • route: don't pollute globals (#2453 @isiahmeadows)
    • request: track xhr replacements correctly (#2455 @isiahmeadows)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(67.43 KB)
    mithril.min.js(25.79 KB)
  • v2.0.0(Jul 24, 2019)

    When publishing, the npm upload got interrupted and it didn't publish properly. So I unpublished it. Don't try installing this version - it won't work!

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-rc.9(Jul 17, 2019)

    This is a hotfix release for critical issues discovered in v2.0.0-rc.8.

    • It did not previously censor magic attributes, causing lifecycle hooks to be double-called. https://github.com/MithrilJS/mithril.js/pull/2471
    • I named the m.route.Link selector argument component: when it should've been called selector:. https://github.com/MithrilJS/mithril.js/pull/2475 (This is the only breaking change.)
    • Routing prevention via ev.preventDefault() was critically broken, and button values and modifier state was incorrectly tested for. https://github.com/MithrilJS/mithril.js/pull/2476

    I also included various docs fixes in this release to clear up some confusion.

    v2.0.0-rc

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)
    • request: data has now been split to params and body and useBody has been removed in favor of just using body. (#2361)
    • route, request: Interpolated arguments are URL-escaped (and for declared routes, URL-unescaped) automatically. If you want to use a raw route parameter, use a variadic parameter like in /asset/:path.../view. This was previously only available in m.route route definitions, but it's now usable in both that and where paths are accepted. (#2361)
    • route, request: Interpolated arguments are not appended to the query string. This means m.request({url: "/api/user/:id/get", params: {id: user.id}}) would result in a request like GET /api/user/1/get, not one like GET /api/user/1/get?id=1. If you really need it in both places, pass the same value via two separate parameters with the non-query-string parameter renamed, like in m.request({url: "/api/user/:urlID/get", params: {id: user.id, urlID: user.id}}). (#2361)
    • route, request: m.route.set, m.request, and m.jsonp all use the same path template syntax now, and vary only in how they receive their parameters. Furthermore, declared routes in m.route shares the same syntax and semantics, but acts in reverse as if via pattern matching. (#2361)
    • request: options.responseType now defaults to "json" if extract is absent, and deserialize receives the parsed response, not the raw string. If you want the old behavior, use responseType: "text". (#2335)
    • request: set Content-Type: application/json; charset=utf-8 for all XHR methods by default, provided they have a body that's != null (#2361, #2421)
      • This can cause CORS issues when issuing GET with bodies, but you can address them through configuring CORS appropriately.
      • Previously, it was only set for all non-GET methods and only when useBody: true was passed (the default), and it was always set for them. Now it's automatically omitted when no body is present, so the hole is slightly broadened.
    • route: query parameters in hash strings are no longer supported (#2448 @isiahmeadows)
      • It's technically invalid in hashes, so I'd rather push people to keep in line with spec.
    • render: validate all elements are either keyed or unkeyed, and treat null/undefined/booleans as strictly unkeyed (#2452 @isiahmeadows)
      • Gives a nice little perf boost with keyed fragments.
      • Minor, but imperceptible impact (within the margin of error) with unkeyed fragments.
      • Also makes the model a lot more consistent - all values are either keyed or unkeyed.
    • vnodes: normalize boolean children to null/undefined at the vnode level, always stringify non-object children that aren't holes (#2452 @isiahmeadows)
      • Previously, true was equivalent to "true" and false was equivalent to "".
      • Previously, numeric children weren't coerced. Now, they are.
      • Unlikely to break most components, but it could break some users.
      • This increases consistency with how booleans are handled with children, so it should be more intuitive.
    • route: key parameter for routes now only works globally for components (#2458 @isiahmeadows)
      • Previously, it worked for route resolvers, too.
      • This lets you ensure global layouts used in render still render by diff.
    • redraw: mithril/redraw now just exposes the m.redraw callback (#2458 @isiahmeadows)
      • The .schedule, .unschedule, and .render properties of the former redrawService are all removed.
      • If you want to know how to work around it, look at the call to mount in Mithril's source for m.route. That should help you in finding ways around the removed feature. (It doesn't take that much more code.)
    • api: m.version has been removed. If you really need the version for whatever reason, just read the version field of mithril/package.json directly. (#2466 @isiahmeadows)
    • route: m.route.prefix(...) is now m.route.prefix = .... (#2469 @isiahmeadows)
      • This is a fully fledged property, so you can not only write to it, but you can also read from it.
      • This aligns better with user intuition.
    • route: m.route.link function removed in favor of m.route.Link component. (#2469 @isiahmeadows)
      • An optional options object is accepted as an attribute. This was initially targeting the old m.route.link function and was transferred to this. (#1930)
      • The new component handles many more edge cases around user interaction, including accessibility.
      • Link navigation can be disabled and cancelled.
      • Link targets can be trivially changed.
    • API: Full DOM no longer required to execute require("mithril"). You just need to set the necessary globals to something, even if null or undefined, so they can be properly used. (#2469 @isiahmeadows)
      • This enables isomorphic use of m.route.Link and m.route.prefix.
      • This enables isomorphic use of m.request, provided the background: true option is set and that an XMLHttpRequest polyfill is included as necessary.
      • Note that methods requiring DOM operations will still throw errors, such as m.render(...), m.redraw(), and m.route(...).

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)
    • route: Declared routes may check against path names with query strings. (#2361)
    • route: Declared routes in m.route now support - and . as delimiters for path segments. This means you can have a route like "/edit/:file.:ext". (#2361)
      • Previously, this was possible to do in m.route.set, m.request, and m.jsonp, but it was wholly untested for and also undocumented.
    • API: m.buildPathname and m.parsePathname added. (#2361)
    • route: Use m.mount(root, null) to unsubscribe and clean up after a m.route(root, ...) call. (#2453)
    • render: new redraw parameter exposed any time a child event handler is used (#2458 @isiahmeadows)
    • route: m.route.SKIP can be returned from route resolvers to skip to the next route (#2469 @isiahmeadows)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    • render: simplify component removal (#2214)
    • render: remove some redundancy within the component initialization code (#2213)
    • API: mithril loads mithril/index.js, not the bundle, so users of mithril/hyperscript, mithril/render, and similar see the same Mithril instance as those just using mithril itself.
      • https://unpkg.com/mithril is configured to receive the minified bundle, not the development bundle.
      • The raw bundle itself remains accessible at mithril.js, and is not browser-wrapped.
      • Note: this will increase overhead with bundlers like Webpack, Rollup, and Browserify.
    • request: autoredraw support fixed for async/await in Chrome (#2428 @isiahmeadows)
    • render: fix when attrs change with onbeforeupdate returning false, then remaining the same on next redraw (#2447 @isiahmeadows)
    • render: fix internal error when onbeforeupdate returns false and then true with new child tree (#2447 @isiahmeadows)
    • route: arbitrary prefixes are properly supported now, including odd prefixes like ?# and invalid prefixes like #foo#bar (#2448 @isiahmeadows)
    • request: correct IE workaround for response type non-support (#2449 @isiahmeadows)
    • render: correct contenteditable check to also check for contentEditable property name (#2450 @isiahmeadows)
    • docs: clarify valid key usage (#2452 @isiahmeadows)
    • route: don't pollute globals (#2453 @isiahmeadows)
    • request: track xhr replacements correctly (#2455 @isiahmeadows)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(67.43 KB)
    mithril.min.js(25.79 KB)
  • v2.0.0-rc.8(Jul 12, 2019)

    🚨🚨🚨 This is the final release candidate. There will be no more breaking changes added between now and when v2.0.0 stable is released. What you see here is precisely what to expect from v2.0.0 beyond small bug fixes. 🚨🚨🚨

    Few new bug fixes, but a few major breaking changes since v2.0.0-rc.7.

    • require("mithril/redraw") now returns the m.redraw function directly. There is no longer any redrawService exposed in any way. https://github.com/MithrilJS/mithril.js/pull/2458
    • m.version no longer exists. In general, rely on feature detection, not version detection. https://github.com/MithrilJS/mithril.js/pull/2466
    • The m.route.link method has been replaced with the m.route.Link component, with a capital L. https://github.com/MithrilJS/mithril.js/pull/2469
    • The m.route.prefix method has been made a property instead. https://github.com/MithrilJS/mithril.js/pull/2469

    And a couple new features:

    • You can use m.route.SKIP to skip a route from onmatch. https://github.com/MithrilJS/mithril.js/pull/2469
    • It's now safe to require("mithril") in environments that lack a full DOM implementation. You just need a few of the globals defined, even if just to null or undefined, to ensure proper instantiation. https://github.com/MithrilJS/mithril.js/pull/2469

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)
    • request: data has now been split to params and body and useBody has been removed in favor of just using body. (#2361)
    • route, request: Interpolated arguments are URL-escaped (and for declared routes, URL-unescaped) automatically. If you want to use a raw route parameter, use a variadic parameter like in /asset/:path.../view. This was previously only available in m.route route definitions, but it's now usable in both that and where paths are accepted. (#2361)
    • route, request: Interpolated arguments are not appended to the query string. This means m.request({url: "/api/user/:id/get", params: {id: user.id}}) would result in a request like GET /api/user/1/get, not one like GET /api/user/1/get?id=1. If you really need it in both places, pass the same value via two separate parameters with the non-query-string parameter renamed, like in m.request({url: "/api/user/:urlID/get", params: {id: user.id, urlID: user.id}}). (#2361)
    • route, request: m.route.set, m.request, and m.jsonp all use the same path template syntax now, and vary only in how they receive their parameters. Furthermore, declared routes in m.route shares the same syntax and semantics, but acts in reverse as if via pattern matching. (#2361)
    • request: options.responseType now defaults to "json" if extract is absent, and deserialize receives the parsed response, not the raw string. If you want the old behavior, use responseType: "text". (#2335)
    • request: set Content-Type: application/json; charset=utf-8 for all XHR methods by default, provided they have a body that's != null (#2361, #2421)
      • This can cause CORS issues when issuing GET with bodies, but you can address them through configuring CORS appropriately.
      • Previously, it was only set for all non-GET methods and only when useBody: true was passed (the default), and it was always set for them. Now it's automatically omitted when no body is present, so the hole is slightly broadened.
    • route: query parameters in hash strings are no longer supported (#2448 @isiahmeadows)
      • It's technically invalid in hashes, so I'd rather push people to keep in line with spec.
    • render: validate all elements are either keyed or unkeyed, and treat null/undefined/booleans as strictly unkeyed (#2452 @isiahmeadows)
      • Gives a nice little perf boost with keyed fragments.
      • Minor, but imperceptible impact (within the margin of error) with unkeyed fragments.
      • Also makes the model a lot more consistent - all values are either keyed or unkeyed.
    • vnodes: normalize boolean children to null/undefined at the vnode level, always stringify non-object children that aren't holes (#2452 @isiahmeadows)
      • Previously, true was equivalent to "true" and false was equivalent to "".
      • Previously, numeric children weren't coerced. Now, they are.
      • Unlikely to break most components, but it could break some users.
      • This increases consistency with how booleans are handled with children, so it should be more intuitive.
    • route: key parameter for routes now only works globally for components (#2458 @isiahmeadows)
      • Previously, it worked for route resolvers, too.
      • This lets you ensure global layouts used in render still render by diff.
    • redraw: mithril/redraw now just exposes the m.redraw callback (#2458 @isiahmeadows)
      • The .schedule, .unschedule, and .render properties of the former redrawService are all removed.
      • If you want to know how to work around it, look at the call to mount in Mithril's source for m.route. That should help you in finding ways around the removed feature. (It doesn't take that much more code.)
    • api: m.version has been removed. If you really need the version for whatever reason, just read the version field of mithril/package.json directly. (#2466 @isiahmeadows)
    • route: m.route.prefix(...) is now m.route.prefix = .... (#2469 @isiahmeadows)
      • This is a fully fledged property, so you can not only write to it, but you can also read from it.
      • This aligns better with user intuition.
    • route: m.route.link function removed in favor of m.route.Link component. (#2469 @isiahmeadows)
      • An optional options object is accepted as an attribute. This was initially targeting the old m.route.link function and was transferred to this. (#1930)
      • The new component handles many more edge cases around user interaction, including accessibility.
      • Link navigation can be disabled and cancelled.
      • Link targets can be trivially changed.
    • API: Full DOM no longer required to execute require("mithril"). You just need to set the necessary globals to something, even if null or undefined, so they can be properly used. (#2469 @isiahmeadows)
      • This enables isomorphic use of m.route.Link and m.route.prefix.
      • This enables isomorphic use of m.request, provided the background: true option is set and that an XMLHttpRequest polyfill is included as necessary.
      • Note that methods requiring DOM operations will still throw errors, such as m.render(...), m.redraw(), and m.route(...).

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)
    • route: Declared routes may check against path names with query strings. (#2361)
    • route: Declared routes in m.route now support - and . as delimiters for path segments. This means you can have a route like "/edit/:file.:ext". (#2361)
      • Previously, this was possible to do in m.route.set, m.request, and m.jsonp, but it was wholly untested for and also undocumented.
    • API: m.buildPathname and m.parsePathname added. (#2361)
    • route: Use m.mount(root, null) to unsubscribe and clean up after a m.route(root, ...) call. (#2453)
    • render: new redraw parameter exposed any time a child event handler is used (#2458 @isiahmeadows)
    • route: m.route.SKIP can be returned from route resolvers to skip to the next route (#2469 @isiahmeadows)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    • render: simplify component removal (#2214)
    • render: remove some redundancy within the component initialization code (#2213)
    • API: mithril loads mithril/index.js, not the bundle, so users of mithril/hyperscript, mithril/render, and similar see the same Mithril instance as those just using mithril itself.
      • https://unpkg.com/mithril is configured to receive the minified bundle, not the development bundle.
      • The raw bundle itself remains accessible at mithril.js, and is not browser-wrapped.
      • Note: this will increase overhead with bundlers like Webpack, Rollup, and Browserify.
    • request: autoredraw support fixed for async/await in Chrome (#2428 @isiahmeadows)
    • render: fix when attrs change with onbeforeupdate returning false, then remaining the same on next redraw (#2447 @isiahmeadows)
    • render: fix internal error when onbeforeupdate returns false and then true with new child tree (#2447 @isiahmeadows)
    • route: arbitrary prefixes are properly supported now, including odd prefixes like ?# and invalid prefixes like #foo#bar (#2448 @isiahmeadows)
    • request: correct IE workaround for response type non-support (#2449 @isiahmeadows)
    • render: correct contenteditable check to also check for contentEditable property name (#2450 @isiahmeadows)
    • docs: clarify valid key usage (#2452 @isiahmeadows)
    • route: don't pollute globals (#2453 @isiahmeadows)
    • request: track xhr replacements correctly (#2455 @isiahmeadows)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(67.20 KB)
    mithril.min.js(25.73 KB)
  • v2.0.0-rc.7(Jul 6, 2019)

    v2.0.0-rc.7

    Several new bug fixes, including the dreaded Uncaught TypeError: Cannot read property 'onbeforeupdate' of undefined on Chrome, TypeError: vnode.state is undefined on Firefox, but there are also a few breaking changes since v2.0.0-rc.6:

    • Paths no longer accept #a=b&c=d as equivalent to ?a=b&c=d. This aligns with the URL spec better, where # is itself illegal in URL fragments. https://github.com/MithrilJS/mithril.js/pull/2448
    • Fragments must either all contain keys or none contain keys. This is not only recommended by the docs, but also enforced by the framework itself. https://github.com/MithrilJS/mithril.js/pull/2452
    • null/undefined are no longer valid in keyed fragments. https://github.com/MithrilJS/mithril.js/pull/2452
    • true, false, and undefined are all normalized to null at the vnode level. Unlikely to break people, as the past behavior was so counterintuitive and inconsistent people actively avoided using it as it had a knack for creating subtle bugs. https://github.com/MithrilJS/mithril.js/pull/2452

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)
    • request: data has now been split to params and body and useBody has been removed in favor of just using body. (#2361)
    • route, request: Interpolated arguments are URL-escaped (and for declared routes, URL-unescaped) automatically. If you want to use a raw route parameter, use a variadic parameter like in /asset/:path.../view. This was previously only available in m.route route definitions, but it's now usable in both that and where paths are accepted. (#2361)
    • route, request: Interpolated arguments are not appended to the query string. This means m.request({url: "/api/user/:id/get", params: {id: user.id}}) would result in a request like GET /api/user/1/get, not one like GET /api/user/1/get?id=1. If you really need it in both places, pass the same value via two separate parameters with the non-query-string parameter renamed, like in m.request({url: "/api/user/:urlID/get", params: {id: user.id, urlID: user.id}}). (#2361)
    • route, request: m.route.set, m.request, and m.jsonp all use the same path template syntax now, and vary only in how they receive their parameters. Furthermore, declared routes in m.route shares the same syntax and semantics, but acts in reverse as if via pattern matching. (#2361)
    • request: options.responseType now defaults to "json" if extract is absent, and deserialize receives the parsed response, not the raw string. If you want the old behavior, use responseType: "text". (#2335)
    • request: set Content-Type: application/json; charset=utf-8 for all XHR methods by default, provided they have a body that's != null (#2361, #2421)
      • This can cause CORS issues when issuing GET with bodies, but you can address them through configuring CORS appropriately.
      • Previously, it was only set for all non-GET methods and only when useBody: true was passed (the default), and it was always set for them. Now it's automatically omitted when no body is present, so the hole is slightly broadened.
    • route: query parameters in hash strings are no longer supported (#2448 @isiahmeadows)
      • It's technically invalid in hashes, so I'd rather push people to keep in line with spec.
    • render: validate all elements are either keyed or unkeyed, and treat null/undefined/booleans as strictly unkeyed (#2452 @isiahmeadows)
      • Gives a nice little perf boost with keyed fragments.
      • Minor, but imperceptible impact (within the margin of error) with unkeyed fragments.
      • Also makes the model a lot more consistent - all values are either keyed or unkeyed.
    • vnodes: normalize boolean children to null/undefined at the vnode level, always stringify non-object children that aren't holes (#2452 @isiahmeadows)
      • Previously, true was equivalent to "true" and false was equivalent to "".
      • Previously, numeric children weren't coerced. Now, they are.
      • Unlikely to break most components, but it could break some users.
      • This increases consistency with how booleans are handled with children, so it should be more intuitive.

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)
    • route: Declared routes may check against path names with query strings. (#2361)
    • route: Declared routes in m.route now support - and . as delimiters for path segments. This means you can have a route like "/edit/:file.:ext". (#2361)
      • Previously, this was possible to do in m.route.set, m.request, and m.jsonp, but it was wholly untested for and also undocumented.
    • API: m.buildPathname and m.parsePathname added. (#2361)
    • route: Use m.mount(root, null) to unsubscribe and clean up after a m.route(root, ...) call. (#2453)
    • version: m.version returns the previous version string for what's in next. (#2453)
      • If you're using next, you should hopefully know what you're doing. If you need stability, don't use next. (This is also why I'm not labelling it as a breaking change.)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    • render: simplify component removal (#2214)
    • render: remove some redundancy within the component initialization code (#2213)
    • API: mithril loads mithril/index.js, not the bundle, so users of mithril/hyperscript, mithril/render, and similar see the same Mithril instance as those just using mithril itself.
      • https://unpkg.com/mithril is configured to receive the minified bundle, not the development bundle.
      • The raw bundle itself remains accessible at mithril.js, and is not browser-wrapped.
      • Note: this will increase overhead with bundlers like Webpack, Rollup, and Browserify.
    • request: autoredraw support fixed for async/await in Chrome (#2428 @isiahmeadows)
    • render: fix when attrs change with onbeforeupdate returning false, then remaining the same on next redraw (#2447 @isiahmeadows)
    • render: fix internal error when onbeforeupdate returns false and then true with new child tree (#2447 @isiahmeadows)
    • route: arbitrary prefixes are properly supported now, including odd prefixes like ?# and invalid prefixes like #foo#bar (#2448 @isiahmeadows)
    • request: correct IE workaround for response type non-support (#2449 @isiahmeadows)
    • render: correct contenteditable check to also check for contentEditable property name (#2450 @isiahmeadows)
    • docs: clarify valid key usage (#2452 @isiahmeadows)
    • route: don't pollute globals (#2453 @isiahmeadows)
    • request: track xhr replacements correctly (#2455 @isiahmeadows)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(66.00 KB)
    mithril.min.js(26.00 KB)
  • v2.0.0-rc.6(May 31, 2019)

    Note: this is a pure bug fix update. It includes #2421, but is otherwise basically the same as v2.0.0-rc.5.

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)
    • request: data has now been split to params and body and useBody has been removed in favor of just using body. (#2361)
    • route, request: Interpolated arguments are URL-escaped (and for declared routes, URL-unescaped) automatically. If you want to use a raw route parameter, use a variadic parameter like in /asset/:path.../view. This was previously only available in m.route route definitions, but it's now usable in both that and where paths are accepted. (#2361)
    • route, request: Interpolated arguments are not appended to the query string. This means m.request({url: "/api/user/:id/get", params: {id: user.id}}) would result in a request like GET /api/user/1/get, not one like GET /api/user/1/get?id=1. If you really need it in both places, pass the same value via two separate parameters with the non-query-string parameter renamed, like in m.request({url: "/api/user/:urlID/get", params: {id: user.id, urlID: user.id}}). (#2361)
    • route, request: m.route.set, m.request, and m.jsonp all use the same path template syntax now, and vary only in how they receive their parameters. Furthermore, declared routes in m.route shares the same syntax and semantics, but acts in reverse as if via pattern matching. (#2361)
    • request: options.responseType now defaults to "json" if extract is absent, and deserialize receives the parsed response, not the raw string. If you want the old behavior, use responseType: "text". (#2335)
    • request: set Content-Type: application/json; charset=utf-8 for all XHR methods by default, provided they have a body that's != null (#2361, #2421)
      • This can cause CORS issues when issuing GET with bodies, but you can address them through configuring CORS appropriately.
      • Previously, it was only set for all non-GET methods and only when useBody: true was passed (the default), and it was always set for them. Now it's automatically omitted when no body is present, so the hole is slightly broadened.

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)
    • route: Declared routes may check against path names with query strings. (#2361)
    • route: Declared routes in m.route now support - and . as delimiters for path segments. This means you can have a route like "/edit/:file.:ext". (#2361)
      • Previously, this was possible to do in m.route.set, m.request, and m.jsonp, but it was wholly untested for and also undocumented.
    • API: m.buildPathname and m.parsePathname added. (#2361)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    • render: simplify component removal (#2214)
    • render: remove some redundancy within the component initialization code (#2213)
    • API: mithril loads mithril/index.js, not the bundle, so users of mithril/hyperscript, mithril/render, and similar see the same Mithril instance as those just using mithril itself.
      • https://unpkg.com/mithril is configured to receive the minified bundle, not the development bundle.
      • The raw bundle itself remains accessible at mithril.js, and is not browser-wrapped.
      • Note: this will increase overhead with bundlers like Webpack, Rollup, and Browserify.
    Source code(tar.gz)
    Source code(zip)
    mithril.js(63.03 KB)
    mithril.min.js(25.43 KB)
  • v2.0.0-rc.5(May 29, 2019)

    PSA: ESM builds have been dropped from v2.0 as of #2366. Please update your scripts accordingly, as only CommonJS is supported until we can figure out a way to enable ES module support in a way that doesn't break everyone. (I've had to help troubleshoot way too many Webpack issues to feel comfortable with side-by-side support.)

    If all goes well with this release candidate, it will go stable as you see it now.

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)
    • request: data has now been split to params and body and useBody has been removed in favor of just using body. (#2361)
    • route, request: Interpolated arguments are URL-escaped (and for declared routes, URL-unescaped) automatically. If you want to use a raw route parameter, use a variadic parameter like in /asset/:path.../view. This was previously only available in m.route route definitions, but it's now usable in both that and where paths are accepted. (#2361)
    • route, request: Interpolated arguments are not appended to the query string. This means m.request({url: "/api/user/:id/get", params: {id: user.id}}) would result in a request like GET /api/user/1/get, not one like GET /api/user/1/get?id=1. If you really need it in both places, pass the same value via two separate parameters with the non-query-string parameter renamed, like in m.request({url: "/api/user/:urlID/get", params: {id: user.id, urlID: user.id}}). (#2361)
    • route, request: m.route.set, m.request, and m.jsonp all use the same path template syntax now, and vary only in how they receive their parameters. Furthermore, declared routes in m.route shares the same syntax and semantics, but acts in reverse as if via pattern matching. (#2361)
    • request: options.responseType now defaults to "json" if extract is absent, and deserialize receives the parsed response, not the raw string. If you want the old behavior, use responseType: "text". (#2335)

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)
    • route: Declared routes may check against path names with query strings. (#2361)
    • route: Declared routes in m.route now support - and . as delimiters for path segments. This means you can have a route like "/edit/:file.:ext". (#2361)
      • Previously, this was possible to do in m.route.set, m.request, and m.jsonp, but it was wholly untested for and also undocumented.
    • API: m.buildPathname and m.parsePathname added. (#2361)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    • render: simplify component removal (#2214)
    • render: remove some redundancy within the component initialization code (#2213)
    • API: mithril loads mithril/index.js, not the bundle, so users of mithril/hyperscript, mithril/render, and similar see the same Mithril instance as those just using mithril itself.
      • https://unpkg.com/mithril is configured to receive the minified bundle, not the development bundle.
      • The raw bundle itself remains accessible at mithril.js, and is not browser-wrapped.
      • Note: this will increase overhead with bundlers like Webpack, Rollup, and Browserify.
    Source code(tar.gz)
    Source code(zip)
    mithril.js(63.01 KB)
    mithril.min.js(25.43 KB)
  • v2.0.0-rc.4(Feb 5, 2019)

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • stream: when a stream conditionally returns HALT, dependant stream will also end (#2200)
    • render: remove some redundancy within the component initialization code (#2213)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • render: simplify component removal (#2214)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • stream: Add stream.lift as a user-friendly alternative to merge -> map or combine #1944
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(59.07 KB)
    mithril.min.js(24.33 KB)
    mithril.mjs(59.59 KB)
    mithril.min.mjs(24.92 KB)
  • v2.0.0-rc.3(Dec 6, 2018)

    Breaking changes since v2.0.0-rc.1

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • API: m.request errors no longer copy response fields to the error, but instead assign the parsed JSON response to error.response and the HTTP status code error.code.
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • stream: when a stream conditionally returns HALT, dependant stream will also end (#2200)
    • render: remove some redundancy within the component initialization code (#2213)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • render: simplify component removal (#2214)
    • cast className using toString (#2309)
    • render: call attrs' hooks first, with express exception of onbeforeupdate to allow attrs to block components from even diffing (#2297)
    • API: m.withAttr removed. (#2317)

    News

    • Mithril now only officially supports IE11, Firefox ESR, and the last two versions of Chrome/FF/Edge/Safari. (#2296)
    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • docs: Emphasize Closure Components for stateful components, use them for all stateful component examples.
    • stream: Add stream.lift as a user-friendly alternative to merge -> map or combine #1944
    • API: ES module bundles are now available for mithril and mithril/stream (#2194 @porsager).
      • All of the m.* properties from mithril are re-exported as named exports in addition to being attached to m.
      • m() itself from mithril is exported as the default export.
      • mithril/stream's primary export is exported as the default export.
    • fragments: allow same attrs/children overloading logic as hyperscript (#2328)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2250 @isiahmeadows, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    • render/core: CSS vars can now be specified in {style} attributes (#2192 @barneycarroll), (#2311 @porsager), (#2312 @isiahmeadows)
    • request: don't modify params, call extract/serialize/deserialize with correct this value (#2288)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(59.00 KB)
    mithril.min.js(24.28 KB)
    mithril.mjs(59.52 KB)
    mithril.min.mjs(24.87 KB)
  • v2.0.0-rc.2(Dec 6, 2018)

  • v2.0.0-rc.1(Nov 7, 2018)

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • stream: when a stream conditionally returns HALT, dependant stream will also end (#2200)
    • render: remove some redundancy within the component initialization code (#2213)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • render: simplify component removal (#2214)

    News

    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.
    • API: Introduction of m.prop() (#2268)

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa, #2265, @isiahmeadows)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    • render/core: Vnodes stored in the dom node supplied to m.render() are now normalized #2266
    Source code(tar.gz)
    Source code(zip)
    mithril.js(57.14 KB)
    mithril.min.js(24.41 KB)
  • v2.0.0-rc.0(Oct 25, 2018)

    Breaking changes

    • API: Component vnode children are not normalized into vnodes on ingestion; normalization only happens if and when they are ingested by the view (#2155 (thanks to @magikstm for related optimization #2064))
    • API: m.redraw() is always asynchronous (#1592)
    • API: m.mount() will only render its own root when called, it will not trigger a redraw() (#1592)
    • API: Assigning to vnode.state (as in vnode.state = ...) is no longer supported. Instead, an error is thrown if vnode.state changes upon the invocation of a lifecycle hook.
    • API: m.request will no longer reject the Promise on server errors (eg. status >= 400) if the caller supplies an extract callback. This gives applications more control over handling server responses.
    • hyperscript: when attributes have a null or undefined value, they are treated as if they were absent. #1773 (#2174)
    • hyperscript: when an attribute is defined on both the first and second argument (as a CSS selector and an attrs field, respectively), the latter takes precedence, except for class attributes that are still added together. #2172 (#2174)
    • stream: when a stream conditionally returns HALT, dependant stream will also end (#2200)
    • render: remove some redundancy within the component initialization code (#2213)
    • render: Align custom elements to work like normal elements, minus all the HTML-specific magic. (#2221)
    • render: simplify component removal (#2214)

    News

    • API: Introduction of m.redraw.sync() (#1592)
    • API: Event handlers may also be objects with handleEvent methods (#1949, #2222).
    • API: m.route.link accepts an optional options object (#1930)
    • API: m.request better error message on JSON parse error - (#2195, @codeclown)
    • API: m.request supports timeout as attr - (#1966)
    • API: m.request supports responseType as attr - (#2193)
    • Mocks: add limited support for the DOMParser API (#2097)
    • API: add support for raw SVG in m.trust() string (#2097)
    • render/core: remove the DOM nodes recycling pool (#2122)
    • render/core: revamp the core diff engine, and introduce a longest-increasing-subsequence-based logic to minimize DOM operations when re-ordering keyed nodes.

    Bug fixes

    • API: m.route.set() causes all mount points to be redrawn (#1592)
    • render/attrs: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
    • render/attrs All vnodes attributes are properly removed when absent or set to null or undefined #1804 #2082 (#1865, #2130)
    • render/core: Render state correctly on select change event #1916 (#1918 @robinchew, #2052)
    • render/core: fix various updateNodes/removeNodes issues when the pool and fragments are involved #1990, #1991, #2003, #2021
    • render/core: fix crashes when the keyed vnodes with the same key had different tag values #2128 @JacksonJN (#2130)
    • render/core: fix cached nodes behavior in some keyed diff scenarios #2132 (#2130)
    • render/events: addEventListener and removeEventListener are always used to manage event subscriptions, preventing external interference.
    • render/events: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via m.mount()/m.redraw().
    • render/events: Object.prototype properties can no longer interfere with event listener calls.
    • render/events: Event handlers, when set to literally undefined (or any non-function), are now correctly removed.
    • render/hooks: fixed an ommission that caused oninit to be called unnecessarily in some cases #1992
    • docs: tweaks: (#2104 @mikeyb, #2205, @cavemansspa)
    • render/core: avoid touching Object.prototype.__proto__ setter with key: "__proto__" in certain situations (#2251)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(56.99 KB)
    mithril.min.js(23.67 KB)
  • v1.1.5(Oct 13, 2017)

  • v1.1.4(Sep 26, 2017)

    Bug fixes:

    • core: don't call onremove on the children of components that return null from the view #1921 octavore (#1922)
    • hypertext: correct handling of shared attributes object passed to m(). Will copy attributes when it's necessary #1941 s-ilya (#1942)
    • Fix IE bug where active element is null causing render function to throw error. (1943)

    Ospec improvements:

    • Log using util.inspect to show object content instead of "[object Object]" (#1661, @porsager)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(45.21 KB)
    mithril.min.js(21.63 KB)
  • v1.1.3(Jul 11, 2017)

  • v1.1.2(Jul 11, 2017)

    Bug fixes:

    Ospec improvements:

    • Shell command: Ignore hidden directories and files (#1855 @pdfernhout))
    • Library: Add the possibility to name new test suites (#1529)

    Docs / Repo maintenance:

    Our thanks to @0joshuaolson1, @ACXgit, @cavemansspa, @CreaturesInUnitards, @dlepaux, @isaaclyman, @kevinkace, @micellius, @spacejack and @yurivish

    Other:

    • Addition of a performance regression test suite (#1789)
    Source code(tar.gz)
    Source code(zip)
    mithril.js(45.07 KB)
    mithril.min.js(21.62 KB)
  • v1.1.1(Apr 4, 2017)

  • v1.1.0(Mar 27, 2017)

Lightweight MVC library for building JavaScript applications

Spine Spine is a lightweight MVC library for building JavaScript web applications. Spine gives you structure and then gets out of your way, allowing y

Spine JS Project 3.6k Jan 4, 2023
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Supporting Vue.js Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome ba

vuejs 201.7k Jan 8, 2023
🌟 DataFormsJS 🌟 A minimal JavaScript Framework and standalone React and Web Components for rapid development of high quality websites and single page applications.

?? Welcome to DataFormsJS! Thanks for visiting! ?? ?? ?? ?? ?? ?? 中文 (简体) 欢迎来到 DataFormsJS Español Bienvenido a DataFormsJS Português (do Brasil) Bem

DataFormsJS 156 Dec 8, 2022
Ember.js - A JavaScript framework for creating ambitious web applications

Ember.js is a JavaScript framework that greatly reduces the time, effort and resources needed to build any web application. It is focused on making yo

Ember.js 22.4k Jan 8, 2023
A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Feathers 14.2k Dec 28, 2022
A framework for building native apps with React.

React Native Learn once, write anywhere: Build mobile apps with React. Getting Started · Learn the Basics · Showcase · Contribute · Community · Suppor

Facebook 106.8k Jan 3, 2023
MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Derby The Derby MVC framework makes it easy to write realtime, collaborative applications that run in both Node.js and browsers. Derby includes a powe

DerbyJS 4.7k Dec 31, 2022
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces

Inferno is an insanely fast, React-like library for building high-performance user interfaces on both the client and server. Description The main obje

Inferno 15.6k Jan 3, 2023
JavaScript UI library for data-driven web applications

Road to 2.0 The master branch has new, in-progress version of w2ui. You might want to consider 1.5 branch that is stable and supports older browsers.

Vitali Malinouski 2.4k Jan 3, 2023
A tiny foundation for building reactive views

ripple.js A tiny foundation for building reactive views with plugins. It aims to have a similar API to Reactive, but allow composition of views, like

ripple.js 1.3k Dec 9, 2022
HTML Framework that allows you not to write JavaScript code.

EHTML (or Extended HTML) can be described as a set of custom elements that you can put on HTML page for different purposes and use cases. The main ide

Guseyn Ismayylov 171 Dec 29, 2022
A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM,

Alpine.js 22.5k Dec 30, 2022
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

Bootstrap Sleek, intuitive, and powerful front-end framework for faster and easier web development. Explore Bootstrap docs » Report bug · Request feat

Bootstrap 161.1k Jan 4, 2023
A no-dependency, intuitive web framework from scratch in Javascript

Poseidon ?? Intro Poseidon is, to use a nice description by Reef, an anti-framework. It's a a no-dependency, component-based Javascript framework for

Amir Bolous 45 Nov 14, 2022
hell.js 🚀 🚀 A JavaScript framework for the 🔥 next 🔥 generation. 🚀

hell.js ?? ?? A JavaScript framework for the ?? next ?? generation. ??

null 31 Oct 3, 2022
The worlds smallest fully-responsive css framework

FLUIDITY A fully responsive css framework that is impossibly small HTML is almost 100% responsive out of the box. This stylesheet patches the remainin

murmurs 1.1k Sep 24, 2022
An HTML5/CSS3 framework used at SAPO for fast and efficient website design and prototyping

Welcome to Ink Ink is an interface kit for quick development of web interfaces, simple to use and expand on. It uses a combination of HTML, CSS and Ja

SAPO 1.9k Dec 15, 2022
One framework. Mobile & desktop.

Angular - One framework. Mobile & desktop. Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScr

Angular 85.7k Jan 4, 2023