Commit graph

1138 commits

Author SHA1 Message Date
Matheus Kautzmann
343ffc8d36 m.module -> m.mount: fix sample code in HTML files 2015-08-28 09:07:08 -03:00
Matheus Kautzmann
dfa1da0652 m.module -> m.mount: fix README 2015-08-27 17:05:27 -03:00
Leo Horie
d3cbbef4d5 Merge pull request #766 from avesus/patch-2
Module -> mount rename: fix a documentation link
2015-08-18 22:07:44 -04:00
Leo Horie
23a7811ad7 Merge pull request #767 from jakobdamjensen/next
Make m.route.param() return all params
2015-08-18 22:07:18 -04:00
Jakob Dam Jensen
caf1138c31 Make m.route.param() return all params #737 2015-08-18 20:44:58 +02:00
Ivan Borisenko
8a8829c2e1 Module -> mount rename: fix a documentation link 2015-08-18 21:42:08 +03: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
5944ed026b Merge remote-tracking branch 'origin/next' into next 2015-08-04 15:02:00 -04:00
Leo Horie
cfdc0a27ce add badge for supported source 2015-08-04 15:01:37 -04:00
Leo Horie
ab8af3ea1d Merge pull request #741 from impinball/next
Bump npm version
2015-08-04 14:52:18 -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
Leo Horie
282da527af Merge pull request #753 from marcolamberto/next
Fixes #721. Firefox insertAdjacentHTML updating text nodes
2015-08-04 14:51:36 -04:00
Leo Horie
7b070fd679 Merge pull request #754 from patrkris/closure-externs
Update externs for Google Closure compiler
2015-08-04 14:51:06 -04:00
Patrick Kristiansen
132fe16176 Update externs for Google Closure compiler 2015-08-04 16:57:13 +02: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
Leo Horie
c01c07d648 Merge pull request #751 from islahul/next
style fixes spaces and indentation
2015-08-03 09:34:07 -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
352d093d90 test for correct this on m.withAttr callback 2015-08-01 15:01:38 -05:00
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
impinball
5111c75746 Bump npm version
Fixes #740. It really needs it... :(

Also, I fixed some weird indentation going on in that area of the package.json
file (mixed spaces/tabs).
2015-07-27 18:48:08 -04:00
Derrick Gilland
937b20984d Update promise.finally test for non-propagation of promise value to finally callback. 2015-07-27 11:29:08 -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
Leo Horie
a23a32a3d9 Merge pull request #734 from dgilland/feature-propify-finally
Add `finally` to promise-like object.
2015-07-27 09:39:37 -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
ed3f3f0686 document component shorthand syntax 2015-07-23 23:43:19 -04:00
Leo Horie
2b24c7a64d changing links to point to absolute path 2015-07-23 23:25:28 -04:00
Leo Horie
bc94836931 Merge branch 'Naddiseo-patch-1' into next 2015-07-23 23:15:27 -04:00
Leo Horie
0d7cc43bfe Merge branch 'patch-1' of https://github.com/Naddiseo/mithril.js into Naddiseo-patch-1
Conflicts:
	tests/mithril-tests.js
2015-07-23 23:15:05 -04:00
Leo Horie
a57b1986ac update change log 2015-07-23 23:13:03 -04:00
Leo Horie
c8ae577c63 #660 return empty object if parsing empty string 2015-07-23 23:11:41 -04:00
Leo Horie
34a96d9428 added links to relevant sections 2015-07-23 23:05:09 -04:00
Leo Horie
2fe869e4f0 fix memory release check 2015-07-23 22:33:15 -04:00
Leo Horie
abb6208650 clean up dead code 2015-07-23 22:13:08 -04:00
Leo Horie
54ea70d2d6 dereference unused dom elements, controllers and components 2015-07-23 22:10:59 -04:00
Leo Horie
5baab5f034 update change log 2015-07-23 22:04:43 -04:00
Leo Horie
3f4ef8f41a Merge branch 'open-node-next' into next 2015-07-23 21:57:40 -04:00
Leo Horie
2f135885a6 Merge branch 'next' of https://github.com/open-node/mithril.js into open-node-next
Conflicts:
	mithril.js
2015-07-23 21:57:21 -04:00
Leo Horie
372cf30e8e docs for catch 2015-07-23 21:52:32 -04:00
Leo Horie
d6cbba0b2e Merge branch 'venning-next' into next 2015-07-23 21:52:14 -04:00
Leo Horie
3a367eb279 Merge branch 'next' of https://github.com/venning/mithril.js into venning-next
Conflicts:
	mithril.js
2015-07-23 21:52:05 -04:00
Leo Horie
b0c876f57b Merge pull request #729 from impinball/speed
Profile and optimize
2015-07-23 21:28:42 -04:00
impinball
986dde6d5f Merge remote-tracking branch 'upstream/next' into speed, unfix "fixed" version
By "fixed", I mean "screwed up, not at all following the correct version
number, and refusing to ask on Gitter what the correct version really is, and
just assuming the wrong version despite hints all over the source screaming
'THIS IS THE CORRECT VERSION, YOU STUPID IDIOT!!!'".

I feel that should be a relatively accurate explanation of the mistake I made
while working on this patch (the specific commit that introduced it was
squashed in rebasing, and another commit was easier than a revert, since the
one that introduced it also entailed a few other things).
2015-07-23 05:26:31 -04:00
impinball
3de01a1554 Clean up tests, resolve style differences, reduce upstream diff
This is in preparation for a PR, to reduce potential for merge conflicts
with either my PR or others', since mine will modify a large amount of
the main file.
2015-07-23 05:25:18 -04:00
impinball
565f9cf334 Merge branch 'next' of https://github.com/impinball/mithril.js into speed
(Update topic branch)
2015-07-23 05:20:36 -04:00
impinball
9ae592ee4d Do some local style modifications and profile.
1. Do some temporary style modifications to help make the code more readable
   for profiling (with help from ESLint).
2. Profile the code, and optimize accordingly.
2015-07-23 05:17:02 -04:00