Commit graph

471 commits

Author SHA1 Message Date
Julien Bisconti
bd0ce5c06b Overriding extract option in m.request
fixes: #859
2015-12-01 18:04:11 +01: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
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
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
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
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
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
Miles Matthias
d2812bd88d added version function to mithril and test for version function 2015-07-16 22:11:07 -06:00
Leo Horie
aeedc6fbb0 Merge pull request #720 from impinball/next
Forgot to assign the default argument
2015-07-14 19:15:38 -04:00
Leo Horie
7732f28cad style 2015-07-14 19:11:45 -04:00
Leo Horie
dcbb82f7d2 Merge remote-tracking branch 'origin/next' into next 2015-07-14 19:11:31 -04:00
Leo Horie
6040a4dc67 prevent null ref 2015-07-14 19:11:11 -04:00
Leo Horie
3894ec683c make controller inherit from prototype if in m.component 2015-07-14 19:10:12 -04:00
impinball
fcb5842938 Fix default assign 2015-07-13 15:12:25 -04:00
impinball
a22710284e Fix default assign 2015-07-13 15:00:10 -04:00
impinball
a4e6567b82 Forgot to assign the default argument 2015-07-13 14:53:26 -04:00
impinball
c0830ee3d6 Refactor a couple pointless variables out 2015-07-10 13:15:03 -04:00
impinball
83a30a4d3c Add type-checking methods, make a few things stop de-opting under Chrome 2015-07-09 15:31:13 -04:00
impinball
b28045aa60 Add parameter names to m.route 2015-07-09 14:19:47 -04:00
impinball
293df33858 Dry up code in build 2015-07-09 14:10:59 -04:00
impinball
c764f8d826 Use named arguments in m 2015-07-09 13:17:33 -04:00
Leo Horie
919f443099 simplify condition 2015-06-29 09:35:04 -04:00
Leo Horie
dbc3bc81e4 Merge pull request #692 from pelonpelon/patch-15
mithril.js: fix if clause that expects truthy value. issue: #689
2015-06-29 09:34:52 -04:00
Leo Horie
8da643c13f use bracket syntax for reserved keyword 2015-06-29 09:22:20 -04:00