add tentative fix for #29
https://github.com/lhorie/mithril.js/issues/29 TODO: test cost of relying on native equality checks
This commit is contained in:
parent
62eae50b20
commit
86ba3474a6
5 changed files with 7 additions and 6 deletions
|
|
@ -119,14 +119,14 @@ new function(window) {
|
|||
function setAttributes(node, dataAttrs, cachedAttrs) {
|
||||
for (var attrName in dataAttrs) {
|
||||
var dataAttr = dataAttrs[attrName]
|
||||
if (!(attrName in cachedAttrs) || (cachedAttrs[attrName] !== dataAttr)) {
|
||||
//if (!(attrName in cachedAttrs) || (cachedAttrs[attrName] !== dataAttr)) {
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
if (attrName == "config") continue
|
||||
if (attrName.indexOf("on") == 0 && typeof dataAttr == "function") dataAttr = autoredraw(dataAttr, node)
|
||||
if (attrName == "style") for (var rule in dataAttr) node.style[rule] = dataAttr[rule]
|
||||
else if (attrName in node) node[attrName] = dataAttr
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
}
|
||||
//}
|
||||
}
|
||||
return cachedAttrs
|
||||
}
|
||||
|
|
@ -180,6 +180,7 @@ new function(window) {
|
|||
var currentRoot, currentModule = {view: function() {}}, currentController = {}, now = 0, lastRedraw = 0, lastRedrawId = 0
|
||||
m.module = function(root, module) {
|
||||
m.startComputation()
|
||||
cellCache = {}
|
||||
currentRoot = root
|
||||
currentModule = module
|
||||
currentController = new module.controller
|
||||
|
|
|
|||
2
archive/v0.1.2/mithril.min.js
vendored
2
archive/v0.1.2/mithril.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -119,14 +119,14 @@ new function(window) {
|
|||
function setAttributes(node, dataAttrs, cachedAttrs) {
|
||||
for (var attrName in dataAttrs) {
|
||||
var dataAttr = dataAttrs[attrName]
|
||||
if (!(attrName in cachedAttrs) || (cachedAttrs[attrName] !== dataAttr)) {
|
||||
//if (!(attrName in cachedAttrs) || (cachedAttrs[attrName] !== dataAttr)) {
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
if (attrName == "config") continue
|
||||
if (attrName.indexOf("on") == 0 && typeof dataAttr == "function") dataAttr = autoredraw(dataAttr, node)
|
||||
if (attrName == "style") for (var rule in dataAttr) node.style[rule] = dataAttr[rule]
|
||||
else if (attrName in node) node[attrName] = dataAttr
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
}
|
||||
//}
|
||||
}
|
||||
return cachedAttrs
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue