fix ordering issue where previous sibling is array
This commit is contained in:
parent
e5f0d7cebb
commit
8fd5069439
60 changed files with 6944 additions and 10 deletions
10
mithril.js
10
mithril.js
|
|
@ -47,11 +47,12 @@ new function(window) {
|
|||
}
|
||||
|
||||
if (dataType == "[object Array]") {
|
||||
var nodes = [], intact = cached.length === data.length
|
||||
var nodes = [], intact = cached.length === data.length, subArrayCount = 0
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var item = build(parent, data[i], cached[i], shouldReattach, index + i || i, namespace)
|
||||
var item = build(parent, data[i], cached[i], shouldReattach, index + subArrayCount || subArrayCount, namespace)
|
||||
if (item === undefined) continue
|
||||
if (!item.nodes.intact) intact = false
|
||||
subArrayCount += item instanceof Array ? item.length : 1
|
||||
cached[i] = item
|
||||
}
|
||||
if (!intact) {
|
||||
|
|
@ -187,14 +188,15 @@ new function(window) {
|
|||
},
|
||||
insertBefore: function(node, reference) {
|
||||
this.appendChild(node)
|
||||
}
|
||||
},
|
||||
childNodes: []
|
||||
}
|
||||
var nodeCache = [], cellCache = {}
|
||||
m.render = function(root, cell) {
|
||||
var index = nodeCache.indexOf(root)
|
||||
var id = index < 0 ? nodeCache.push(root) - 1 : index
|
||||
var node = root == window.document || root == window.document.documentElement ? documentNode : root
|
||||
cellCache[id] = build(node, cell, cellCache[id], false)
|
||||
cellCache[id] = build(node, cell, cellCache[id], false, 0)
|
||||
}
|
||||
|
||||
m.trust = function(value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue