Merge remote-tracking branch 'origin/next' into components

This commit is contained in:
Leo Horie 2015-02-24 21:26:07 -05:00
commit 06c6e56cc4
5 changed files with 14 additions and 5 deletions

View file

@ -13,6 +13,7 @@
- fix routing bug in IE9 [#320](https://github.com/lhorie/mithril.js/issues/320)
- fix ordering bug in m.trust when using HTML entities [#453](https://github.com/lhorie/mithril.js/issues/453)
- set promise's default value to initialValue if coming from m.request [#454](https://github.com/lhorie/mithril.js/issues/454)
---

View file

@ -433,8 +433,8 @@ where:
[Object<any> data,]
[Boolean background,]
[any initialValue,]
[any unwrapSuccess(any data),]
[any unwrapError(any data),]
[any unwrapSuccess(any data, XMLHttpRequest xhr),]
[any unwrapError(any data, XMLHttpRequest xhr),]
[String serialize(any dataToSerialize),]
[any deserialize(String dataToDeserialize),]
[any extract(XMLHttpRequest xhr, XHROptions options),]

View file

@ -57,7 +57,7 @@ You can use it by adding a reference to your Typescript files. This will allow t
### Internet Explorer Compatibility
Mithril relies on some Ecmascript 5 features, namely: `Array::indexOf`, `Array::map` and `Object::keys`, as well as the `JSON` object.
Mithril relies on some ECMAScript 5 features, namely: `Array::indexOf`, `Array::map` and `Object::keys`, as well as the `JSON` object. Internet Explorer 8 lacks native support for some of these features.
The easiest way to polyfill these features is to include this script:
@ -79,4 +79,4 @@ You can also use other polyfills to support these features in IE7.
Mithril also has a dependency on XMLHttpRequest. If you wish to support IE6, you'll need [a shim for it](https://gist.github.com/Contra/2709462). IE7 and lower do not support cross-domain AJAX requests.
In addition, note that most `m.route` modes rely on `history.pushState` in order to allow moving from one page to another without a browser refresh. [IE9 and lower](http://caniuse.com/#search=pushstate) do not support this feature and will gracefully degrade to page refreshes instead.
In addition, note that most `m.route` modes rely on `history.pushState` in order to allow moving from one page to another without a browser refresh. [IE9 and lower](http://caniuse.com/#search=pushstate) do not support this feature and will gracefully degrade to page refreshes instead.

View file

@ -786,7 +786,8 @@ var m = (function app(window, undefined) {
var prop = m.prop();
promise.then(prop);
prop.then = function(resolve, reject) {
return propify(promise.then(resolve, reject))
promise = promise.then(resolve, reject).then(prop);
return prop;
};
return prop
}

View file

@ -2227,6 +2227,13 @@ function testMithril(mock) {
xhr.onreadystatechange()
return xhr.$headers["Content-Type"] === undefined
})
test(function() {
var prop = m.request({method: "POST", url: "test", initialValue: "foo"}).then(function(data) { return data; })
var initialValue = prop();
mock.XMLHttpRequest.$instances.pop().onreadystatechange()
return initialValue === "foo"
})
test(function() {
var prop = m.request({method: "POST", url: "test", initialValue: "foo"})
var initialValue = prop();