Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use document.currentScript.ownerDocument #3

Open
warpech opened this issue May 16, 2014 · 0 comments
Open

Use document.currentScript.ownerDocument #3

warpech opened this issue May 16, 2014 · 0 comments

Comments

@warpech
Copy link

warpech commented May 16, 2014

In nineties-under-construction.html, I noticed that a hack is used to access the imported document:

var ucImport = document.querySelector('link[href*=under-construction]').import;

This doesn't work for me when an import is requested from another import.

Would you consider replacing it with this snippet that works in such case and is recommented by the Polymer team:

var ucImport;
if (document._currentScript) {
  //@see http://www.polymer-project.org/platform/html-imports.html
  //@see https://groups.google.com/d/topic/polymer-dev/4UKty9tb1-s/discussion 
  ucImport = document._currentScript.ownerDocument;
}
else {
  ucImport = document.currentScript.ownerDocument;
}

Great job btw! Funny and teaching at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant