Skip to content

Commit 4852f6c

Browse files
author
Steven Orvell
committed
custom-style triggers updateStyles if root scope (StyleDefaults) has style properties when the custom-style is created.
1 parent ff72dc6 commit 4852f6c

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎src/lib/custom-style.html‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@
144144
var e = this.__appliedElement;
145145
// used applied element from HTMLImports polyfill or this
146146
if (!settings.useNativeCSSProperties) {
147+
// if default style properties exist when
148+
// this element tries to apply styling then,
149+
// it has been loaded async and needs to trigger a full updateStyles
150+
// to guarantee properties it provides update correctly.
151+
this.__needsUpdateStyles = styleDefaults.hasStyleProperties();
147152
styleDefaults.addStyle(e);
148153
}
149154
// we may not have any textContent yet due to parser yielding
@@ -186,7 +191,6 @@
186191
// build = shady, use = shadow => not supported
187192
// build = shadow, use = shady => needs shimming.
188193
// build = none => needs shimming
189-
190194
var buildType = this.__cssBuild;
191195
var targetedBuild = styleUtil.isTargetedBuild(buildType);
192196

@@ -229,11 +233,6 @@
229233
// `_apply` after B.
230234
// This case should only occur with native webcomponents.
231235
var self = this;
232-
// if Polymer is ready when this element tries to apply styling then,
233-
// it has been loaded async and needs to trigger a full updateStyles
234-
// to guarantee properies update correctly.
235-
this.__needsUpdateStyles = Polymer.RenderStatus.hasRendered() &&
236-
(this.__needsUpdateStyles !== false);
237236
var fn = function fn() {
238237
self._flushCustomProperties();
239238
}

‎src/lib/style-defaults.html‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
return this._properties;
5050
},
5151

52+
hasStyleProperties: function() {
53+
return Boolean(this._properties);
54+
},
55+
5256
_needsStyleProperties: function() {},
5357

5458
_computeStyleProperties: function() {

0 commit comments

Comments
 (0)