Skip to content

Commit 5231d87

Browse files
committed
simpler implementation, only recompute when using shim variables
1 parent 8d97fe6 commit 5231d87

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎src/standard/x-styling.html‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
*/
5454
getComputedStyleValue: function(property) {
5555
// refresh the style properties for this node
56-
this._updateStyleProperties();
56+
if (!nativeVariables) {
57+
this._computeStyleProperties();
58+
}
5759
return !nativeVariables && this._styleProperties &&
5860
this._styleProperties[property] ||
5961
getComputedStyle(this).getPropertyValue(property);
@@ -214,14 +216,12 @@
214216
},
215217

216218
_computeOwnStyleProperties: function() {
217-
if (this._ownStylePropertyNames) {
218-
var props = {};
219-
for (var i=0, n; i < this._ownStylePropertyNames.length; i++) {
220-
n = this._ownStylePropertyNames[i];
221-
props[n] = this._styleProperties[n];
222-
}
223-
this._ownStyleProperties = props;
219+
var props = {};
220+
for (var i=0, n; i < this._ownStylePropertyNames.length; i++) {
221+
n = this._ownStylePropertyNames[i];
222+
props[n] = this._styleProperties[n];
224223
}
224+
this._ownStyleProperties = props;
225225
},
226226

227227
_scopeCount: 0,

‎test/unit/styling-cross-scope-var.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,8 +1336,8 @@
13361336
var e = document.createElement('prop-outer');
13371337
document.body.appendChild(e);
13381338
CustomElements.takeRecords();
1339-
assert.equal(e.getComputedStyleValue('--foo'), 'orange');
1340-
assert.equal(e.$.inner.getComputedStyleValue('--foo'), 'orange');
1339+
assert.equal(e.getComputedStyleValue('--foo').trim(), 'orange');
1340+
assert.equal(e.$.inner.getComputedStyleValue('--foo').trim(), 'orange');
13411341
})
13421342
});
13431343

0 commit comments

Comments
 (0)