-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
|
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 |
This is controlled by https://dom.spec.whatwg.org/#concept-document-allow-declarative-shadow-roots. We should probably rename this to cover both of these behaviors. |
af700a0 to
1e56dfb
Compare
Fixes #11542.
(See WHATWG Working Mode: Changes for more details.)
/dom.html ( diff )
/indices.html ( diff )
/parsing.html ( diff )
/scripting.html ( diff )