From 2923104d27dcc7c715012270cd629b518cfb3e76 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Mon, 13 Apr 2015 08:29:03 -0400 Subject: [PATCH] clean up --- docs/change-log.md | 16 +++++++ mithril.js | 6 +-- mvc.html | 96 ++++++++++++++++++++++++++++++++++++++++++ onerror.html | 8 ++++ tests/index.html | 2 +- tests/mithril-tests.js | 1 - 6 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 mvc.html create mode 100644 onerror.html diff --git a/docs/change-log.md b/docs/change-log.md index c1513df8..e8271c1f 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,5 +1,21 @@ ## Change Log +--- + +[v0.2.0](/mithril/archive/v0.2.0) - improved components + +### News: + +- Mithril modules will be referred to as *components* from now on. +- Virtual DOM tree can now contain [components](mithril.component.md) +- Components can now be parameterized via `m.component` + +### Deprecations: + +- `m.module` has been renamed `m.mount`. Calling `m.module` will still work, but should be considered deprecated. Rationale: Mithril modules and components are the same thing, therefore from now on, they will be referred to as components, since that name is more descriptive of their purpose, and causes less confusion in the face of ES6 modules. + +--- + [v0.1.34](/mithril/archive/v0.1.34) - maintenance ### Bug Fixes: diff --git a/mithril.js b/mithril.js index b8712c7e..2b2d7d5a 100644 --- a/mithril.js +++ b/mithril.js @@ -254,10 +254,10 @@ var m = (function app(window, undefined) { if (!data.attrs) data.attrs = {}; if (!cached.attrs) cached.attrs = {}; - var dataAttrKeys = Object.keys(data.attrs) + var dataAttrKeys = Object.getOwnPropertyNames(data.attrs) var hasKeys = dataAttrKeys.length > ("key" in data.attrs ? 1 : 0) //if an element is different enough from the one in cache, recreate it - if (data.tag != cached.tag || dataAttrKeys.join() != Object.keys(cached.attrs).join() || data.attrs.id != cached.attrs.id || data.attrs.key != cached.attrs.key || (m.redraw.strategy() == "all" && cached.configContext && cached.configContext.retain !== true) || (m.redraw.strategy() == "diff" && cached.configContext && cached.configContext.retain === false)) { + if (data.tag != cached.tag || dataAttrKeys.join() != Object.getOwnPropertyNames(cached.attrs).join() || data.attrs.id != cached.attrs.id || data.attrs.key != cached.attrs.key || (m.redraw.strategy() == "all" && cached.configContext && cached.configContext.retain !== true) || (m.redraw.strategy() == "diff" && cached.configContext && cached.configContext.retain === false)) { if (cached.nodes.length) clear(cached.nodes); if (cached.configContext && typeof cached.configContext.onunload === FUNCTION) cached.configContext.onunload() if (cached.controllers) { @@ -746,7 +746,7 @@ var m = (function app(window, undefined) { // Get all routes and check if there's // an exact match for the current path - var keys = Object.keys(router); + var keys = Object.getOwnPropertyNames(router); var index = keys.indexOf(path); if(index !== -1){ m.mount(root, router[keys [index]]); diff --git a/mvc.html b/mvc.html new file mode 100644 index 00000000..c93d3fd6 --- /dev/null +++ b/mvc.html @@ -0,0 +1,96 @@ + + + \ No newline at end of file diff --git a/onerror.html b/onerror.html new file mode 100644 index 00000000..bf04b0b0 --- /dev/null +++ b/onerror.html @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/tests/index.html b/tests/index.html index 9929de81..f1e4baee 100644 --- a/tests/index.html +++ b/tests/index.html @@ -1,5 +1,5 @@ - + diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 675ac229..f22dd069 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -1780,7 +1780,6 @@ function testMithril(mock) { test(function() { var root = mock.document.createElement("div") var vdom = m("div.a", {class: undefined}) - console.log(vdom) m.render(root, vdom) return root.childNodes[0].class == "a" })