stub HTMLImports

This commit is contained in:
valdrinkoshi
2017-03-22 11:10:01 -07:00
parent 615e811764
commit 79fe34ba80
3 changed files with 4 additions and 13 deletions

View File

@@ -22,13 +22,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
window.addEventListener('WebComponentsReady', function() {
window.webComponentsReadyCount++;
});
// Tell WCT to wait for WebComponentsReady.
window.WCT = {
waitFor: function(cb) {
addEventListener('WebComponentsReady', cb);
}
};
</script>
<script src="../webcomponents-loader.js"></script>
<script src="../../web-component-tester/browser.js"></script>

View File

@@ -20,12 +20,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
window.addEventListener('WebComponentsReady', function() {
window.webComponentsReadyCount++;
});
// Tell WCT to wait for WebComponentsReady.
window.WCT = {
waitFor: function(cb) {
addEventListener('WebComponentsReady', cb);
}
};
</script>
<script src="../webcomponents-loader.js"></script>
<script src="../../web-component-tester/browser.js"></script>

View File

@@ -33,6 +33,8 @@
polyfills = ['lite'];
}
// NOTE: we stub HTMLImports to enable WCT to wait for "WebComponentsReady" event.
window['HTMLImports'] = {};
if (polyfills.length) {
var script = document.querySelector('script[src*="' + name +'"]');
var newScript = document.createElement('script');
@@ -44,6 +46,8 @@
} else {
// Ensure `WebComponentsReady` is fired also when there are no polyfills loaded.
requestAnimationFrame(function() {
// Reset the HTMLImports stub.
window['HTMLImports'] = null;
window.dispatchEvent(new CustomEvent('WebComponentsReady'));
});
}