Commit graph

496 commits

Author SHA1 Message Date
Sean Hussey
c1912d2726 Fixing a few typos. Changing all instances of "thennable" to
"thenable". No functional changes.
2015-12-18 14:40:41 -05:00
impinball
7f7a0a3815 Remove unused parameter 2015-12-16 12:24:12 -05:00
impinball
565ca32d9a Fix issue with a placeholder 2015-12-16 11:54:34 -05:00
impinball
1b4737b0c6 Rewrite most of the last commit of #887 (without the m.request bug) 2015-12-16 11:22:11 -05:00
impinball
69836f3811 Small performance improvements (part 1) 2015-12-16 10:51:43 -05:00
impinball
75a3f0785c Revert "Few more small performance tweaks"
This reverts commit 0e00621840.
2015-12-16 10:37:12 -05:00
impinball
0e00621840 Few more small performance tweaks 2015-12-15 16:56:04 -05:00
impinball
20c3bf07f0 Merge branch 'next' of https://github.com/lhorie/mithril.js into speed 2015-12-15 12:26:07 -05:00
impinball
0b21bd2bda Improve performance (part 2), make smaller, other fixes
Or, a lot of things yet again.

1. Prototypes are avoided. Method definitions are avoided at all costs in the
   renderer. C-like structs are exclusively used internally. This helps
   significantly in both speed and size.

2. The deferred implementation had a couple functions refactored into static
   equivalents.

3. Only 1 test fails now.

4. Several names were changed to be much smaller. Some of the exports were
   aliased. This was a pure size improvement for free.

5. Regexes are inlined. It's better to let the engine do the caching.

6. The version string was inlined. It's still at the top.

7. `this` is avoided as much as possible in the rendering.
2015-12-15 12:22:02 -05:00
Isiah Meadows
b08dba8ad1 Merge pull request #816 from ikki3355/next
links "config" ed with route need to reset pendingRequests count to zero on click
2015-12-15 11:12:49 -05:00
impinball
0a744f6387 Merge branch 'next' of https://github.com/lhorie/mithril.js into speed 2015-12-15 07:10:40 -05:00
impinball
a7b2294c11 OO-ize DOM builder, improve performance (part 1), add benchmarking suite 2015-12-15 07:07:50 -05:00
impinball
9428fe729c s/fufill/resolve/ 2015-12-15 06:38:10 -05:00
impinball
70d2734a58 Merge branch 'next' of https://github.com/lhorie/mithril.js into prop-fix 2015-12-14 06:42:34 -05:00
Einar
71c880d78d fix hasty error 2015-12-11 22:14:08 +00:00
impinball
2a47a8e77d Merge branch 'next' of https://github.com/isiahmeadows/mithril.js into prop-fix 2015-12-10 19:14:32 -05:00
impinball
cb29a21ec3 Fix #873, regenerate minified variants.
Drive-by fix: uppercase tag name in failing m.trust test (doesn't make it
pass, though).
2015-12-10 18:54:43 -05:00
Leo Horie
c5a012b6f6 Merge pull request #877 from nordfjord/next
fix subcomponent unloading
2015-12-10 14:23:21 -05:00
Einar Norðfjörð
5ef5addb82 fix linting errors 2015-12-10 19:01:52 +00:00
Einar Norðfjörð
e846335f16 fix subcomponent unloading 2015-12-10 18:34:08 +00:00
Julien Bisconti
bd0ce5c06b Overriding extract option in m.request
fixes: #859
2015-12-01 18:04:11 +01:00
impinball
90701a4cbb Only call then once in prop.then. 2015-11-26 07:49:15 -05:00
impinball
42723cbeb6 Fully isolate m.prop(), make m.prop().then return current value
Note that this does *not* memoize `then`, another deviation from spec, but
it's unlikely this will actually cause very many bugs. It's also a breaking
change.
2015-11-26 07:44:19 -05:00
impinball
d7ef127be2 Isolate m.prop() and m.deferred() implementations (mostly)
This mostly isolates the implementations for both of these. Now, everything
here calls the method itself, not any of the external methods.

Few driveby fixes as well:

1. Git now ignores archive/ again (it's a build artifact, and can be removed
   when updating `master`)
2. Since I had to rewrite most of the Deferred implementation, the new version
   passes one of the skipped tests, so it is now enabled.
2015-11-20 02:49:48 -05:00
Leo Horie
5269f9b1ce don't use non-standard trim, dies on Travis CI 2015-11-12 23:42:27 -05:00
Leo Horie
4de23eb5c8 Merge remote-tracking branch 'origin/next' into next 2015-11-12 23:31:06 -05:00
Leo Horie
28366212b0 prevent IE error #810 2015-11-12 23:30:50 -05:00
Leo Horie
0b4ec86221 Merge pull request #835 from PaulAvery/next
Do not use `window` when it is not available
2015-11-12 22:47:33 -05:00
Leo Horie
04afc9a2c5 stop eslint nag 2015-11-12 22:36:05 -05:00
Leo Horie
92c9334006 don't break concat scripts 2015-11-12 16:28:58 -05:00
Isiah Meadows
40df7f4860 Forgot to lint 2015-11-08 10:46:19 -05:00
Isiah Meadows
685e71d5a5 Fix #824 2015-11-08 10:30:55 -05:00
Florian Albertz
814b5035ee Do not use window when it is not available 2015-11-07 14:37:29 +01:00
ikki3355
3fa676996c Merge branch 'next' of https://github.com/lhorie/mithril.js into next 2015-11-03 21:55:10 -06:00
impinball
96bcc81022 Lint Mithril main
This changes enough things to merit a new patch release. It changed a few
implementation details in the process, but it's at least much cleaner.

Be ready for every other currently outstanding PR for this file to have merge
conflicts.
2015-11-03 01:32:17 -05:00
ikki3355
c873fa5bf6 clear pendingRequests count on routeUnobtrusive(e) 2015-10-23 08:45:17 -05:00
Jakob Dam Jensen
caf1138c31 Make m.route.param() return all params #737 2015-08-18 20:44:58 +02:00
Leo Horie
7a5980631e Merge pull request #739 from dgilland/origin/feature-propify-finally
Don't pass value/reason to promise.finally callback.
2015-08-04 15:03:47 -04:00
Leo Horie
fe65aa748c Merge pull request #746 from gregdking/next
#745 Remove references to DOM nodes when unmounting (Follow-up to #727)
2015-08-04 14:51:55 -04:00
Marco Lamberto
713b458aea Better detection for Range support. 2015-08-04 13:01:07 +02:00
Marco Lamberto
9a42242454 Fixes #721. Firefox insertAdjacentHTML updating text nodes with "beforeend" instead of creating new ones. 2015-08-04 12:16:29 +02:00
Leo Horie
a9ab36388b Merge pull request #749 from pelonpelon/patch-19
allow m.withAttr callback to determine its own `this` [non-breaking]
2015-08-03 09:35:00 -04:00
islahul
49412ea96b style fixes spaces and indentation
Signed-off-by: islahul <islahulzunjani@gmail.com>
2015-08-03 09:54:58 +05:30
pelonpelon
72c039c4dc allow m.withAttr callback to determine it's own this [non-breaking change]
Background:

In ES6 we now have `Object.setPrototypeOf` which makes prototype delegation an alternative to *sugary*, fake class coding patterns. This can be accomplished in ES5, but ES6 is much more elegant. Here is a basic example. `new` is never used and `this` is very easy to follow.

Working example with changes to mithril.js on lines 854, 858, 859 *only*.
http://jsbin.com/nopugo/1/edit?js,console,output

```javascript

'use strict'

const m = require('mithril')

const DataModel = {
    data: [1,2,3],
    getData(){
        console.log('getting data from server')
        return this.data
    },
    postData(val){
        console.log('sending data to server')
        this.data.push(val)
    }
}
const ViewModel = {
    filterEvenData: function() {
        return this.getData().filter((val) => (val % 2 === 0) && (+val !== 0))
    },
    addNewData: function(val){
        console.log('adding new data', val)
        this.postData(val)
    }
}

var Model = Object.setPrototypeOf(ViewModel, DataModel)

const App = {

    controller(){},

    view(ctrl){
        return m('div', [
            m('pre', [ 'EVEN NUMBERS IN DATA\n',
                this.filterEvenData().map((key,i) =>`${i+1} = ${key}\n`)                
            ]),
            m('div', 'Enter a number'),
            m('input[placeholder=number]', {

                // addNewData is called with **this** === undefined unless we pass `this` to Function.prototype.call in m.withAttr
                onchange: m.withAttr('value', App.addNewData, App),
                value: null
                }
            )
        ]) 
    }
}
Object.setPrototypeOf(App, Model)

m.mount(document.body, App)

```
2015-08-01 14:51:18 -05:00
Greg King
c46567ab81 #745 Remove references to DOM nodes when unmounting
When a null component is passed into m.mount(), remove references to the root DOM element from:
- roots
- cellCache
- nodeCache

And remove the associated entries from:
- controllers
- components
2015-07-29 09:40:32 -04:00
Derrick Gilland
1dc8c31632 Don't pass value/reason to promise.finally callback.
This behavior is inline with ES6.
2015-07-27 11:21:17 -04:00
Derrick Gilland
a52c00fb5f Reformat function syntax style to be in-line with overall style. 2015-07-27 10:38:21 -04:00
Derrick Gilland
23930871a1 Add finally to promise-like object.
Closes #680
2015-07-24 16:57:45 -04:00
Leo Horie
08ebb97ea7 bump version 2015-07-23 23:43:38 -04:00
Leo Horie
c8ae577c63 #660 return empty object if parsing empty string 2015-07-23 23:11:41 -04:00