version bump

multi-island support
typos
react comparison in home
make id change force element recreation
This commit is contained in:
Leo Horie 2014-04-19 17:56:08 -04:00
parent e65db40116
commit d57a145daa
69 changed files with 7147 additions and 24 deletions

View file

@ -1,9 +1,9 @@
new function(window) {
Mithril = m = new function app(window) {
var selectorCache = {}
var type = {}.toString
var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g, attrParser = /\[(.+?)(?:=("|'|)(.+?)\2)?\]/
Mithril = m = function() {
function m() {
var args = arguments
var hasAttrs = type.call(args[1]) == "[object Object]"
var attrs = hasAttrs ? args[1] : {}
@ -64,7 +64,7 @@ new function(window) {
}
}
else if (dataType == "[object Object]") {
if (data.tag != cached.tag || Object.keys(data.attrs).join() != Object.keys(cached.attrs).join()) clear(cached.nodes)
if (data.tag != cached.tag || Object.keys(data.attrs).join() != Object.keys(cached.attrs).join() || data.attrs.id != cached.attrs.id) clear(cached.nodes)
if (typeof data.tag != "string") return
var node, isNew = cached.nodes.length === 0
@ -207,16 +207,20 @@ new function(window) {
return value
}
var currentRoot, currentModule = {view: function() {}}, currentController = {}, now = 0, lastRedraw = 0, lastRedrawId = 0
var roots = [], modules = [], controllers = [], now = 0, lastRedraw = 0, lastRedrawId = 0
m.module = function(root, module) {
m.startComputation()
currentRoot = root
currentModule = module
currentController = new module.controller
var index = roots.indexOf(root)
if (index < 0) index = roots.length
roots[index] = root
modules[index] = module
controllers[index] = new module.controller
m.endComputation()
}
m.redraw = function() {
m.render(currentRoot, currentModule.view(currentController))
for (var i = 0; i < roots.length; i++) {
m.render(roots[i], modules[i].view(controllers[i]))
}
lastRedraw = now
}
function redraw() {
@ -448,9 +452,11 @@ new function(window) {
}
}
if (typeof module != "undefined" && module !== null) module.exports = m
if (typeof define == "function" && define.amd) define(function() {return m})
//testing API
m.deps = function(mock) {return window = mock}
}(this)
return m
}(this)
if (typeof module != "undefined" && module !== null) module.exports = m
if (typeof define == "function" && define.amd) define(function() {return m})