Merge remote-tracking branch 'origin/rewrite' into rewrite

Conflicts:
	docs/keys.md
	docs/signatures.md
	docs/v1.x-migration.md
	index.js
	ospec/bin/ospec.cmd
	request/request.js
	request/tests/test-xhr.js
	util/prop.js
	util/tests/index.html
	util/tests/test-prop.js
This commit is contained in:
Leo Horie 2016-06-20 09:34:14 -04:00
commit bce2abbffd
107 changed files with 1989 additions and 1970 deletions

View file

@ -1,5 +1,4 @@
Migrating from `v0.2.x` to `v1.x`
=================================
# Migrating from `v0.2.x` to `v1.x`
`v1.x` is largely API-compatible with `v0.2.x`, but there are a few breaking changes.
@ -11,6 +10,7 @@ Migrating from `v0.2.x` to `v1.x`
- [`m.route` and anchor tags](#mroute-and-anchor-tags)
- [Reading/writing the current route](#readingwriting-the-current-route)
- [Accessing route params](#accessing-route-params)
- [Setting route prefix](#setting-route-prefix)
## `config` function
@ -84,10 +84,10 @@ In `v1.x` there is no more `controller` property in components, use `oninit` ins
m.mount(document.body, {
controller : function() {
var ctrl = this;
ctrl.fooga = 1;
},
view : function(ctrl) {
return m("p", ctrl.fooga);
}
@ -101,7 +101,7 @@ m.mount(document.body, {
oninit : function(vnode) {
vnode.state.fooga = 1;
},
view : function(vnode) {
return m("p", vnode.state.fooga);
}
@ -112,13 +112,13 @@ m.mount(document.body, {
m.mount(document.body, {
oninit : function(vnode) {
var ctrl = this; // this is bound to vnode.state by default
ctrl.fooga = 1;
},
view : function(vnode) {
var ctrl = this; // this is bound to vnode.state by default
return m("p", ctrl.fooga);
}
});
@ -135,7 +135,7 @@ var component = {
controller : function(options) {
// options.fooga === 1
},
view : function(ctrl, options) {
// options.fooga == 1
}
@ -151,7 +151,7 @@ var component = {
oninit : function(vnode) {
// vnode.attrs.fooga === 1
},
view : function(vnode) {
// vnode.attrs.fooga == 1
}
@ -254,3 +254,19 @@ m.route(document.body, "/booga", {
}
});
```
## Setting route prefix
In `v0.2.x` the route prefix could be set by assigning a string of `"pathname"`, `"hash"`, or `"search"` to `m.route.mode`. In `v1.x` this has been replaced by `m.route.prefix` which is a setter function. Passing it an empty string is analogous to using pathname mode. Other options include passing `"#"` for hash and `"?"` for search.
### `v0.2.x`
```js
m.route.mode = "pathname";
```
### `v1.x`
```js
m.route.prefix("");
```