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

Shadow DOM and <script> #762

Closed
annevk opened this issue Feb 29, 2016 · 4 comments
Closed

Shadow DOM and <script> #762

annevk opened this issue Feb 29, 2016 · 4 comments
Assignees
Labels
topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@annevk
Copy link
Member

annevk commented Feb 29, 2016

(Since the terminology discussion around Shadow DOM is not making fast progress, my idea is that for now I'll try to write some ideas down in individual issues to later be merged into the specification.)

<script> elements will run when inserted if they have a host-including inclusive ancestor that is a document.

currentScript on document and shadow roots will only point to <script> elements that are descendants and return null otherwise. (Existing scripts expecting currentScript to always be them might have to be updated for this.) An alternative here is that only "closed" shadow roots have an exclusive currentScript and that otherwise both that on the document and of the shadow root work. Given how much properties leak the shadow root already that might be okay too?

Anything else?

Paging @hayatoito @smaug---- @rniwa.

@annevk
Copy link
Member Author

annevk commented Feb 29, 2016

(We need to define "shadow-host-including inclusive ancestor" since obviously a <script> in a <template> must not execute.)

@smaug----
Copy link

currentScript on document and shadow roots will only point to <script> elements that are descendants and return null otherwise

Sounds good to me.

I wonder how beforescriptexecute and afterscriptexecute should behave. Those shouldn't cross tree boundaries. So I guess 'scoped flag' should be set when dispatching those events.

@hayatoito
Copy link
Member

currentScript on document and shadow roots will only point to <script> elements that are descendants and return null otherwise

Sounds good to me.

I wonder how beforescriptexecute and afterscriptexecute should behave. Those shouldn't cross tree boundaries. So I guess 'scoped flag' should be set when dispatching those events.

Makes sense. Let me update the spec.

annevk added a commit that referenced this issue Apr 22, 2016
This makes <script> elements work when used in shadow trees. The
beforescriptexecute and afterscriptexecute events won’t work, since
they are already disabled for modules and only makes sense together
with currentScript, which cannot be made to work for shadow scripts.
See #1013 for details.

Fixes #762.
@annevk annevk mentioned this issue Apr 22, 2016
domenic pushed a commit that referenced this issue Apr 22, 2016
This updates the "inserted into a document" and "removed from a document" algorithms to work on all nodes, not just elements. It also redefines them in terms of the DOM Standard's insertion/removing steps for increased precision.

This sets the stage for various shadow DOM-related changes, such as the work on <script> elements necessary for #762.
domenic pushed a commit that referenced this issue Apr 22, 2016
This makes <script> elements work when used in shadow trees. The
beforescriptexecute and afterscriptexecute events won’t work, since
they are already disabled for modules and only makes sense together
with currentScript, which cannot be made to work for shadow scripts.
See #1013 for details.

Fixes #762.
annevk added a commit that referenced this issue Apr 23, 2016
This makes <script> elements work when used in shadow trees. The
beforescriptexecute and afterscriptexecute events won’t work, since
they are already disabled for modules and only makes sense together
with currentScript, which cannot be made to work for shadow scripts.
See #1013 for details.

Fixes #762.
domenic pushed a commit that referenced this issue Apr 26, 2016
This makes <script> elements work when used in shadow trees.

Note that document.currentScript is set to null while running a <script>
in a shadow tree; see #1013 for details.

This takes care of most of #762, but it remains to make the "load" event
scoped, so we'll leave that issue open for now.
@domenic
Copy link
Member

domenic commented Apr 26, 2016

Hmm, I guess this got closed because the original post of the PR said "fixes #762", even though I changed the commit message to no longer say that. Reopening, since we still have to make the "load" event scoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

4 participants