Skip to content

Commit

Permalink
runtimeStyle
Browse files Browse the repository at this point in the history
performance!
  • Loading branch information
nuxodin committed May 29, 2020
1 parent c67beb6 commit d76556f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ie11CustomProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
if (!('innerHTML' in Element.prototype)) {
copyProperty('innerHTML', HTMLElement.prototype, Element.prototype);
}
if (!('runtimeStyle' in Element.prototype)) { // new
copyProperty('runtimeStyle', HTMLElement.prototype, Element.prototype);
}
if (!('sheet' in SVGStyleElement.prototype)) {
Object.defineProperty(SVGStyleElement.prototype, 'sheet', {
get:function(){
Expand Down Expand Up @@ -412,6 +415,9 @@
}
var style = getComputedStyle(el);
let css = '';

el.runtimeStyle.cssText = ''; // new

for (var prop in el.ieCPSelectors) {
var important = style['-ieVar-❗' + prop];
let valueWithVar = important || style['-ieVar-' + prop];
Expand All @@ -428,10 +434,11 @@
// beta
if (!important && details.allByRoot !== false) continue; // dont have to draw root-properties

//let selector = item.selector.replace(/>? \.[^ ]+/, ' ', item.selector); // todo: try to equalize specificity
let selector = item.selector;
css += selector + '.iecp-u' + el.ieCP_unique + item.pseudo + '{' + prop + ':' + value + '}\n';
// el.runtimeStyle[prop] = value; // todo
if (item.pseudo) {
css += item.selector + '.iecp-u' + el.ieCP_unique + item.pseudo + '{' + prop + ':' + value + '}\n';
} else {
el.runtimeStyle[prop] = value; // new
}
}
}
}
Expand Down

0 comments on commit d76556f

Please sign in to comment.