From 6ec5ba361774bed3f6c12f2ce2b41d09aeedbc83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= In a rendering, the The The The contentmethodshadowrootmodeshadowrootdelegatesfocusshadowrootclonabletemplate element represents nothing.contentmethod content attribute is an
+ enumerated attribute with the following keywords and states:
+
+
+
+
+
+ Keyword
+ State
+ Brief description
+
+ replace
+ Replace
+ Replace the target element itself.
+
+ replace-children
+ Replace Children
+ Replace the children of the target element.
+
+ append
+ Append
+ Append after the target element.
+
+ prepend
+ Prepend
+ Prepend before the target element.
+ contentmethod attribute's invalid value default and missing value default are both the None state.shadowrootmode content attribute is an
enumerated attribute with the following keywords and states:ShadowRoot node; otherwise null.
The contentMethod IDL attribute must
+ reflect the contentmethod content
+ attribute, limited to only known values.
The shadowRootMode IDL attribute must
@@ -139403,6 +139446,10 @@ dictionary StorageEventInit : EventInit {
element:
Let the adjusted insertion location be the appropriate place for inserting a node.
If any of the following are false:
contentmethod is not in the None state;shadowrootmode is not in the None state;then insert an HTML element for the token.
+then insert an HTML element for the token and return.
Otherwise:
+If templateStartTag's contentmethod is not in the None state:
TODO
If templateStartTag's shadowrootmode is not in the None state:
Let declarativeShadowHostElement be adjusted current @@ -152714,6 +152778,19 @@ interface External {
true"; "plaintext-only";
"false"
+ contentmethod
+ template
+ replace";
+ "replace-children";
+ "append";
+ "prepend"
+ contentname
+ controls
audio;
From 50a4491e34e2dccbab2883c37c1cddd4d5ca974d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= contentmethod handling:
+ +If element has a contentname attribute and is being inserted into a template + element with a valid contentmethod attribute, find the target element with the same namespace, + localName, and a contentname attribute with the same value.
TODO: is there any whitespace stripping in contentname attribute values?
If the template element is in body, instead search the whole document so
+ that things in head can be patched.
Return if the target element wasn't found
Depending on the contentmethod state, remove existing nodes and update the insertion point.
Question: do we adjust the insertion point simply by setting adjusted insertion location, + or is there other bookkeeping that's needed here?
Let the adjusted insertion location be the appropriate place for inserting a node.
TODO
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.
autocorrectautofocuscontenteditablecontentnamedirdraggableenterkeyhintThe contentname
+ content points to the target for template contentmethod, like an ID attribute.
Should contentname work on only HTML elements, HTML+SVG+MathML, or any element?
+ +If specified, the contentname attribute value must equal
+ the contentname of another element in the same
+ tree.
The shadowrootmode content attribute is an
enumerated attribute with the following keywords and states:
template element whose "contentmethod target" is non-null:Let adjusted insertion location be inside target's "contentmethod target", + after its last child (if any).
+If the adjusted insertion location is inside a template
- element, let it instead be inside the template element's template
- contents, after its last child (if any).
If target is a template element whose "contentmethod target" is
+ non-null, let adjusted insertion location be inside target's
+ "contentmethod target", after its last child (if any).
Otherwise, let adjusted insertion location be inside the
+ template element's template contents, after its last child (if
+ any).
We shouldn't handle contentmethod in both places above. But which is correct? + If we use the first place, should the above "Otherwise" be able to further update the + adjusted insertion location? The test case for this would be something like:
+ +
+ <template contentname="regular-template">
+ <template contentmethod="append">
+ <template contentname="regular-template">
+ <div class="where-does-this-end-up"></div>
+ </template>
+ </template>
+
+ Also, does "inside" above mean any descendent, or only children?
Let the adjusted insertion location be the appropriate place for + inserting a node.
If it is not possible to insert element at the adjusted insertion + location, abort these steps.
If the parser was not created as part of the HTML fragment parsing + algorithm, then push a new element queue onto element's + relevant agent's custom element reactions stack.
contentmethod handling:
+If element's has a contentname attribute
+ specified and adjusted insertion location is inside a template element whose
+ contentmethod attribute is not in the None state:
If element has a contentname attribute and is being inserted into a template - element with a valid contentmethod attribute, find the target element with the same namespace, - localName, and a contentname attribute with the same value.
Let scope be the template element's parent.
TODO: is there any whitespace stripping in contentname attribute values?
If scope is a body element, set scope to its
+ parent.
If the template element is in body, instead search the whole document so
- that things in head can be patched.
Let target be the first element in tree-order within scope with
+ a contentname attribute exactly matching that of
+ element.
Return if the target element wasn't found
If target is null, TODO and return.
Depending on the contentmethod state, remove existing nodes and update the insertion point.
If target doesn't have the same namespace and localName as element, + TODO and return.
Question: do we adjust the insertion point simply by setting adjusted insertion location, - or is there other bookkeeping that's needed here?
Set the template element's "contentmethod target" to target.
Let the adjusted insertion location be the appropriate place for - inserting a node.
The "contentmethod target" will be used later when nodes are to be inserted + into the child of the template element that has a contentname attribute.
+If it is not possible to insert element at the adjusted insertion - location, abort these steps.
Depending on the contentmethod attribute
+ state, potentially remove target or its children and adjust the
+ template element's "contentmethod target" and additionally keep track of the
+ element we should insert before for the "prepend" and "replace" modes.
If the parser was not created as part of the HTML fragment parsing - algorithm, then push a new element queue onto element's - relevant agent's custom element reactions stack.
Should we still insert the element in the following steps? Does it matter?
+ + +Insert element at the adjusted insertion location.
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.
prepend"
contentname
- contentmethod is not in the None state;shadowrootmode is not in the None state;If templateStartTag's contentmethod is not in the None state:
TODO: what to we need to do so that elements are inserted into the template element - and redirected by our pre-insertion steps?
If templateStartTag's shadowrootmode is not in the None state:
Otherwise, if templateStartTag's contentmethod is not in the None state:
TODO: what to we need to do so that elements are inserted into the template element + and redirected by our pre-insertion steps?
Let scope be the template element's parent.
Let scope be the template element's parent.
The template element's parent will often be an element, but can
+ be a DocumentFragment in the fragment case.
If scope is a body element, set scope to its
parent.