Skip to content

Commit

Permalink
simpler implementation, only recompute when using shim variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Nov 3, 2016
1 parent 8d97fe6 commit 5231d87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/standard/x-styling.html
Expand Up @@ -53,7 +53,9 @@
*/
getComputedStyleValue: function(property) {
// refresh the style properties for this node
this._updateStyleProperties();
if (!nativeVariables) {
this._computeStyleProperties();
}
return !nativeVariables && this._styleProperties &&
this._styleProperties[property] ||
getComputedStyle(this).getPropertyValue(property);
Expand Down Expand Up @@ -214,14 +216,12 @@
},

_computeOwnStyleProperties: function() {
if (this._ownStylePropertyNames) {
var props = {};
for (var i=0, n; i < this._ownStylePropertyNames.length; i++) {
n = this._ownStylePropertyNames[i];
props[n] = this._styleProperties[n];
}
this._ownStyleProperties = props;
var props = {};
for (var i=0, n; i < this._ownStylePropertyNames.length; i++) {
n = this._ownStylePropertyNames[i];
props[n] = this._styleProperties[n];
}
this._ownStyleProperties = props;
},

_scopeCount: 0,
Expand Down
4 changes: 2 additions & 2 deletions test/unit/styling-cross-scope-var.html
Expand Up @@ -1336,8 +1336,8 @@
var e = document.createElement('prop-outer');
document.body.appendChild(e);
CustomElements.takeRecords();
assert.equal(e.getComputedStyleValue('--foo'), 'orange');
assert.equal(e.$.inner.getComputedStyleValue('--foo'), 'orange');
assert.equal(e.getComputedStyleValue('--foo').trim(), 'orange');
assert.equal(e.$.inner.getComputedStyleValue('--foo').trim(), 'orange');
})
});

Expand Down

0 comments on commit 5231d87

Please sign in to comment.