Giter Site home page Giter Site logo

Comments (1)

TimvdLippe avatar TimvdLippe commented on July 30, 2024

I think this is fixed in the latest version of the polyfill, where we wait for the load event if necessary:

const gatherElements = element => {
if (element.localName === 'link' && element.getAttribute('rel') === 'import') {
// The HTML Imports polyfill sets a descendant element of the link to
// the `import` property, specifically this is *not* a Document.
const importNode = /** @type {?Node} */ (element.import);
if (importNode instanceof Node) {
importNode.__CE_isImportDocument = true;
// Connected links are associated with the registry.
importNode.__CE_hasRegistry = true;
}
if (importNode && importNode.readyState === 'complete') {
importNode.__CE_documentLoadHandled = true;
} else {
// If this link's import root is not available, its contents can't be
// walked. Wait for 'load' and walk it when it's ready.
element.addEventListener('load', () => {
const importNode = /** @type {!Node} */ (element.import);
if (importNode.__CE_documentLoadHandled) return;
importNode.__CE_documentLoadHandled = true;
// Clone the `visitedImports` set that was populated sync during
// the `patchAndUpgradeTree` call that caused this 'load' handler to
// be added. Then, remove *this* link's import node so that we can
// walk that import again, even if it was partially walked later
// during the same `patchAndUpgradeTree` call.
const clonedVisitedImports = new Set(visitedImports);
clonedVisitedImports.delete(importNode);
this.patchAndUpgradeTree(importNode, {visitedImports: clonedVisitedImports, upgrade});
});
}
} else {
elements.push(element);
}
};
Therefore, I am closing this issue.

from custom-elements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.