Closed seanupton closed 8 years ago
Just to level-set, X-Tag does not use or include the HTML Imports polyfill, so Imports will not work without inclusion of it. We didn't see a ton of benefit to coupling to that spec, given X-Tag developed elements have no reliance on it.
As for the generic question about HTML Imports and dealing with accessing imported documents, you should be able to get the document from the import
property on the link element itself, once it loads:
document.querySelector('link[rel="import"]').import
Note: the link element must be in the DOM and the document resource at the other end must be CORS enabled.
Any feedback? I'd like to close this out if this solves your issue.
I have a template and a script in a document that is imported by
<link rel="import">
but the script cannot access the DOM of the imported document.window.document
refers to the importing document, of course, andwindow.document._currentScript.ownerDocument === window.document
for me (in Firefox 43.0a2)..I have, AFAICT, no way to traverse to my template inside the DOM of the imported document Either this is inconsistent with documentation on webcomponents.org about polyfills, or some alternative is underdocumented?