mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
stub HTMLImports
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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'));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user