Skip to content

Commit

Permalink
custom-style triggers updateStyles if root scope (StyleDefaults) has …
Browse files Browse the repository at this point in the history
…style properties when the custom-style is created.
  • Loading branch information
Steven Orvell committed Jun 22, 2016
1 parent ff72dc6 commit 4852f6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib/custom-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@
var e = this.__appliedElement;
// used applied element from HTMLImports polyfill or this
if (!settings.useNativeCSSProperties) {
// if default style properties exist when
// this element tries to apply styling then,
// it has been loaded async and needs to trigger a full updateStyles
// to guarantee properties it provides update correctly.
this.__needsUpdateStyles = styleDefaults.hasStyleProperties();
styleDefaults.addStyle(e);
}
// we may not have any textContent yet due to parser yielding
Expand Down Expand Up @@ -186,7 +191,6 @@
// build = shady, use = shadow => not supported
// build = shadow, use = shady => needs shimming.
// build = none => needs shimming

var buildType = this.__cssBuild;
var targetedBuild = styleUtil.isTargetedBuild(buildType);

Expand Down Expand Up @@ -229,11 +233,6 @@
// `_apply` after B.
// This case should only occur with native webcomponents.
var self = this;
// if Polymer is ready when this element tries to apply styling then,
// it has been loaded async and needs to trigger a full updateStyles
// to guarantee properies update correctly.
this.__needsUpdateStyles = Polymer.RenderStatus.hasRendered() &&
(this.__needsUpdateStyles !== false);
var fn = function fn() {
self._flushCustomProperties();
}
Expand Down
4 changes: 4 additions & 0 deletions src/lib/style-defaults.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
return this._properties;
},

hasStyleProperties: function() {
return Boolean(this._properties);
},

_needsStyleProperties: function() {},

_computeStyleProperties: function() {
Expand Down

0 comments on commit 4852f6c

Please sign in to comment.