diff --git a/src/lib/custom-style.html b/src/lib/custom-style.html
index 89900edf40..183197ba0f 100644
--- a/src/lib/custom-style.html
+++ b/src/lib/custom-style.html
@@ -128,9 +128,12 @@
if (this.__appliedElement !== this) {
this.__appliedElement.__cssBuild = this.__cssBuild;
}
+ // needed becuase elements in imports do not get 'attached'
this._tryApply();
},
+ // needed to support dynamic custom styles created outside document
+ // and then added to it.
attached: function() {
this._tryApply();
},
@@ -173,7 +176,7 @@
// polyfill this style with root scoping and
// apply custom properties!
- _apply: function(deferProperties) {
+ _apply: function(initialApply) {
// used applied element from HTMLImports polyfill or this
var e = this.__appliedElement;
if (this.include) {
@@ -236,11 +239,8 @@
var fn = function fn() {
self._flushCustomProperties();
}
- if (deferProperties) {
- if (!this.__scheduledPropertiesFlush) {
- this.__scheduledPropertiesFlush = true;
- Polymer.RenderStatus.whenReady(fn);
- }
+ if (initialApply) {
+ Polymer.RenderStatus.whenReady(fn);
} else {
fn();
}
@@ -248,7 +248,6 @@
},
_flushCustomProperties: function() {
- this.__scheduledPropertiesFlush = false;
// if this style has not yet applied at all and it was loaded asynchronously
// (detected by Polymer being ready when this element tried to apply), then
// do a full updateStyles to ensure that