prevent dom recreation if only class value changed
This commit is contained in:
parent
94d804d850
commit
fce5f4b86f
2 changed files with 8 additions and 1 deletions
|
|
@ -61,6 +61,7 @@ var m = (function app(window, undefined) {
|
|||
if (attrs.hasOwnProperty(attrName)) {
|
||||
if (attrName === classAttrName && attrs[attrName] != null && attrs[attrName] !== "") {
|
||||
classes.push(attrs[attrName])
|
||||
cell.attrs[attrName] = "" //create key in correct iteration order
|
||||
}
|
||||
else cell.attrs[attrName] = attrs[attrName]
|
||||
}
|
||||
|
|
@ -259,7 +260,7 @@ var m = (function app(window, undefined) {
|
|||
var dataAttrKeys = Object.keys(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.sort().join() != Object.keys(cached.attrs).sort().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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue