Bundled output for commit 457dd92d46 [skip ci]
This commit is contained in:
parent
457dd92d46
commit
96aa185302
3 changed files with 57 additions and 50 deletions
17
mithril.js
17
mithril.js
|
|
@ -905,6 +905,18 @@ var coreRenderer = function($window) {
|
|||
}
|
||||
//style
|
||||
function updateStyle(element, old, style) {
|
||||
if (old != null && style != null && typeof old === "object" && typeof style === "object" && style !== old) {
|
||||
// Both old & new are (different) objects.
|
||||
// Update style properties that have changed
|
||||
for (var key2 in style) {
|
||||
if (style[key2] !== old[key2]) element.style[key2] = style[key2]
|
||||
}
|
||||
// Remove style properties that no longer exist
|
||||
for (var key2 in old) {
|
||||
if (!(key2 in style)) element.style[key2] = ""
|
||||
}
|
||||
return
|
||||
}
|
||||
if (old === style) element.style.cssText = "", old = null
|
||||
if (style == null) element.style.cssText = ""
|
||||
else if (typeof style === "string") element.style.cssText = style
|
||||
|
|
@ -913,11 +925,6 @@ var coreRenderer = function($window) {
|
|||
for (var key2 in style) {
|
||||
element.style[key2] = style[key2]
|
||||
}
|
||||
if (old != null && typeof old !== "string") {
|
||||
for (var key2 in old) {
|
||||
if (!(key2 in style)) element.style[key2] = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//event
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue