Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit f3eb922

Browse files
committed
Refine timing related to calling Polymer() in main document scripts when polymer is imported.
1 parent cb58f30 commit f3eb922

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/declaration/polymer-element.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@
167167
// make window.Polymer reference `element()`
168168
window.Polymer = element;
169169

170+
// Under the HTMLImports polyfill, scripts in the main document
171+
// do not block on imports; we want to allow calls to Polymer in the main
172+
// document. We do so via coordination with Platform:
173+
var declarations = Platform.deliverDeclarations();
174+
if (declarations) {
175+
for (var i=0, l=declarations.length, d; (i<l) && (d=declarations[i]); i++) {
176+
element.apply(null, d);
177+
}
178+
}
179+
170180
// register polymer-element with document
171181
document.register('polymer-element', {prototype: prototype});
172182
})(Polymer);

0 commit comments

Comments
 (0)