Overwrite an element's style using cssText
This is the proper way to do it: https://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-cssText
This commit is contained in:
parent
4f8dc68426
commit
b0848070bc
1 changed files with 4 additions and 4 deletions
|
|
@ -441,11 +441,11 @@ module.exports = function($window) {
|
|||
|
||||
//style
|
||||
function updateStyle(element, old, style) {
|
||||
if (old === style) element.style = "", old = null
|
||||
if (style == null) element.style = ""
|
||||
else if (typeof style === "string") element.style = style
|
||||
if (old === style) element.cssText = "", old = null
|
||||
if (style == null) element.cssText = ""
|
||||
else if (typeof style === "string") element.cssText = style
|
||||
else {
|
||||
if (typeof old === "string") element.style = ""
|
||||
if (typeof old === "string") element.cssText = ""
|
||||
for (var key in style) {
|
||||
element.style[key] = style[key]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue