-
Notifications
You must be signed in to change notification settings - Fork 3k
Add <template contentmethod> for declarative out-of-order streaming #11818
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
base: main
Are you sure you want to change the base?
Conversation
source
Outdated
|
|
||
| <li><p>Depending on the contentmethod state, remove existing nodes and update the insertion point.</p></li> | ||
|
|
||
| <li><p>Question: do we adjust the insertion point simply by setting <var>adjusted insertion location</var>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit more involved because we need to adjust the location based on the grandparent's contentmethod and the parent's contentname.
source
Outdated
| <li><p>TODO: what to we need to do so that elements are inserted into the template element | ||
| and redirected by our pre-insertion steps? We need to undo whatever it is that causes nodes | ||
| to be inserted into the DocumentFragment normally.</p></li> | ||
| </ol> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the "adjusted insertion location" or whatever it's called
|
I've made some additional changes but things don't quite make sense yet. The direction I'm heading in is:
There are options for where to store the bookkeeping. I initially put it on the |
It also needs to fail if that first element is no longer a child of the target.
Yea makes sense, that way you don't have to deal with grandparents. |
|
I've now rewritten a lot of this to make it match my previous comment, and I think it's in good enough shape for review now. I left two inline issues:
and
@noamr for the first one, you said we should fail, but what would that mean? |
It means no further content is prepended. |
|
Okay, should that state be sticky, or what happens if the nodes later realign so that the check passes? |
Yea I think it errors the whole thing |
|
Missing pieces following the TPAC session:
|
|
I've given some thoughts to error handling for <!doctype html>
<body>
<div contentname=foo><span id=refnode>will be removed</span></div>
<template contentmethod=prepend>
<div contentname=foo>
<p>this element is inserted</p>
<!-- the script removes the "content target first child" node -->
<script>window.refnode = document.getElementById('refnode'); refnode.remove();</script>
<p>reference node is gone, can this element be inserted?</p>
<!-- put the reference node back -->
<script>document.querySelector('[contentname=foo]').appendChild(refnode);</script>
<p>is this OK because the reference node is back?</p>
</div>
<div contentname=foo>
<p>is this fine because we saved a new reference node?</p>
</div>
</template>Options on what constitutes an error:
Options on handling:
Options on reporting:
It looks like the parser currently never fires events while it's still running, the only events are "DOMContentLoaded" and "load". Anything else that seems be fired by parsing is actually triggered by some other algorithm run as a side effect of what the parser does. I don't think that parse errors are a good fit either, because the error can't easily be expressed in terms of the input, but the shape of the DOM tree. My thinking now is that we should instead guarantee that the nodes are inserted, that we don't discard node midstream. For |
Fixes #11542.
(See WHATWG Working Mode: Changes for more details.)
/dom.html ( diff )
/indices.html ( diff )
/parsing.html ( diff )
/scripting.html ( diff )