mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
remove HTMLImports stub
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
// order expected
|
||||
assert.deepEqual(a1DocsList, ['a1-instance.html', 'a1-reference.html']);
|
||||
// style applied at upgrade time
|
||||
if (!HTMLImports.useNative) {
|
||||
if (window.HTMLImports) {
|
||||
assert.isTrue(styleAppliedToDocument);
|
||||
}
|
||||
done();
|
||||
|
||||
@@ -26,11 +26,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
link.rel = 'import';
|
||||
link.href = 'imports/element-import.html';
|
||||
document.head.appendChild(link);
|
||||
|
||||
HTMLImports.whenReady(function() {
|
||||
link.addEventListener('load', function() {
|
||||
assert.isTrue(xfoo.isCreated, 'element in main document, registered in dynamic import is upgraded');
|
||||
var ix = link.import.querySelector('x-foo');
|
||||
assert.equal(HTMLImports.importForElement(ix), link.import, 'import for element should be link import');
|
||||
assert.isTrue(ix.isCreated, 'element in import, registered in dynamic import is upgraded');
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
|
||||
test('upgraded document tree', function(done) {
|
||||
if (CustomElements.useNative || HTMLImports.useNative) {
|
||||
if (CustomElements.useNative || !window.HTMLImports) {
|
||||
return done();
|
||||
} else {
|
||||
window.addEventListener('WebComponentsReady', function() {
|
||||
|
||||
@@ -30,7 +30,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
suite('Loader', function() {
|
||||
test('expected boot', function() {
|
||||
assert.equal(window.webComponentsReadyCount, 1, 'failed to fire WebComponentsReady');
|
||||
if (!window.HTMLImports.useNative) {
|
||||
if (window.HTMLImports) {
|
||||
assert.ok(window.importsOk, 'WebComponentsReady without HTMLImportsLoaded');
|
||||
}
|
||||
assert.ok(window.importTest, 'import failed to set global value');
|
||||
|
||||
@@ -11,29 +11,7 @@
|
||||
(function() {
|
||||
// Feature detect which polyfill needs to be imported.
|
||||
let polyfills = [];
|
||||
if ('import' in document.createElement('link')) {
|
||||
// Stub out HTMLImports if we're using native imports.
|
||||
window.HTMLImports = {
|
||||
useNative: true,
|
||||
importForElement: function(el) {
|
||||
return el.ownerDocument !== document ? el.ownerDocument : null;
|
||||
},
|
||||
whenReady: function(callback) {
|
||||
// When native imports boot, the are "ready" the first rAF after
|
||||
// the document becomes interactive, so wait for the correct state change.
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('readystatechange', function once() {
|
||||
document.removeEventListener('readystatechange', once);
|
||||
HTMLImports.whenReady(callback);
|
||||
});
|
||||
} else if (document.readyState === 'interactive') {
|
||||
requestAnimationFrame(callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (!('import' in document.createElement('link'))) {
|
||||
polyfills.push('hi');
|
||||
}
|
||||
if (!('attachShadow' in Element.prototype) || (window.ShadyDOM && window.ShadyDOM.force)) {
|
||||
@@ -69,10 +47,8 @@
|
||||
// is removed. Addressing this is blocked on
|
||||
// https://github.com/webcomponents/shadycss/issues/46.
|
||||
if (polyfills[0] === 'none') {
|
||||
HTMLImports.whenReady(function() {
|
||||
requestAnimationFrame(function() {
|
||||
window.dispatchEvent(new CustomEvent('WebComponentsReady'));
|
||||
});
|
||||
requestAnimationFrame(function() {
|
||||
window.dispatchEvent(new CustomEvent('WebComponentsReady'));
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user