Skip to content

Commit 97d3cfd

Browse files
committed
Flesh things out more
1 parent 50a4491 commit 97d3cfd

File tree

1 file changed

+83
-28
lines changed

1 file changed

+83
-28
lines changed

source

Lines changed: 83 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13894,6 +13894,7 @@ https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%
1389413894
<li><code data-x="attr-autocorrect">autocorrect</code></li>
1389513895
<li><code data-x="attr-fe-autofocus">autofocus</code></li>
1389613896
<li><code data-x="attr-contenteditable">contenteditable</code></li>
13897+
<li><code data-x="attr-contentname">contentname</code></li>
1389713898
<li><code data-x="attr-dir">dir</code></li>
1389813899
<li><code data-x="attr-draggable">draggable</code></li>
1389913900
<li><code data-x="attr-enterkeyhint">enterkeyhint</code></li>
@@ -67930,6 +67931,17 @@ interface <dfn interface>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
6793067931
default">missing value default</i> are both the <dfn
6793167932
data-x="attr-contentmethod-none-state">None</dfn> state.</p>
6793267933

67934+
<p>The <dfn element-attr for="htmlsvg-global"><code data-x="attr-contentname">contentname</code></dfn>
67935+
content points to the target for template contentmethod, like an ID attribute.</p>
67936+
<!-- TODO better words, and should this be in another section since it's not for <template>? -->
67937+
67938+
<p class="XXX">Should contentname work on only HTML elements, HTML+SVG+MathML, or any element?</p>
67939+
67940+
<p>If specified, the <code data-x="attr-contentname">contentname</code> attribute value must equal
67941+
the <code data-x="attr-contentname">contentname</code> of another element in the same
67942+
<span>tree</span>.</p>
67943+
<!-- TODO: make this non-symmetrical and matching the processing model -->
67944+
6793367945
<p>The <dfn element-attr for="template"><code
6793467946
data-x="attr-template-shadowrootmode">shadowrootmode</code></dfn> content attribute is an
6793567947
<span>enumerated attribute</span> with the following keywords and states:</p>
@@ -139294,6 +139306,13 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {
139294139306
parser.</p>
139295139307
</dd>
139296139308

139309+
<dt>If <var>target</var> is a <code>template</code> element whose "contentmethod target" is non-null:</dt>
139310+
139311+
<dd>
139312+
<p>Let <var>adjusted insertion location</var> be inside <var>target</var>'s "contentmethod target",
139313+
after its last child (if any).</p>
139314+
</dd>
139315+
139297139316
<dt>Otherwise</dt>
139298139317

139299139318
<dd>
@@ -139305,8 +139324,31 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {
139305139324

139306139325
<li>
139307139326
<p>If the <var>adjusted insertion location</var> is inside a <code>template</code>
139308-
element, let it instead be inside the <code>template</code> element's <span>template
139309-
contents</span>, after its last child (if any).</p>
139327+
element:</p>
139328+
139329+
<ol>
139330+
<li><p>If <var>target</var> is a <code>template</code> element whose "contentmethod target" is
139331+
non-null, let <var>adjusted insertion location</var> be inside <var>target</var>'s
139332+
"contentmethod target", after its last child (if any).</p></li>
139333+
139334+
<li><p>Otherwise, let <var>adjusted insertion location</var> be inside the
139335+
<code>template</code> element's <span>template contents</span>, after its last child (if
139336+
any).</p></li>
139337+
</ol>
139338+
139339+
<p class="XXX">We shouldn't handle contentmethod in both places above. But which is correct?
139340+
If we use the first place, should the above "Otherwise" be able to further update the
139341+
adjusted insertion location? The test case for this would be something like:</p>
139342+
139343+
<pre><code class="html">
139344+
&lt;template contentname="regular-template">
139345+
&lt;template contentmethod="append">
139346+
&lt;template contentname="regular-template">
139347+
&lt;div class="where-does-this-end-up">&lt;/div>
139348+
&lt;/template>
139349+
&lt;/template></code></pre>
139350+
139351+
<p class="XXX">Also, does "inside" above mean any descendent, or only children?</p>
139310139352
</li>
139311139353

139312139354
<li>
@@ -139446,40 +139488,54 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {
139446139488
<var>element</var>:</p>
139447139489

139448139490
<ol>
139449-
<!-- Either here and before every other call to "adjusted insertion location", or maybe inside
139450-
"adjusted insertion location", adjust the insertion location based on contentmethod and the
139451-
first child element of the template. -->
139491+
<li><p>Let the <var>adjusted insertion location</var> be the <span>appropriate place for
139492+
inserting a node</span>.</p></li>
139493+
139494+
<li><p>If it is not possible to insert <var>element</var> at the <var>adjusted insertion
139495+
location</var>, abort these steps.</p></li>
139496+
139497+
<li><p>If the parser was not created as part of the <span>HTML fragment parsing
139498+
algorithm</span>, then push a new <span>element queue</span> onto <var>element</var>'s
139499+
<span>relevant agent</span>'s <span>custom element reactions stack</span>.</p></li>
139500+
139452139501
<li>
139453-
<p>contentmethod handling:</p>
139502+
<p>If <var>element</var>'s has a <code data-x="attr-contentname">contentname</code> attribute
139503+
specified and <var>adjusted insertion location</var> is inside a <code>template</code> element whose
139504+
<code data-x="attr-template-contentmethod">contentmethod</code> attribute is not in the <span
139505+
data-x="attr-contentmethod-none-state">None</span> state:</p>
139454139506

139455139507
<ol>
139456-
<li><p>If <var>element</var> has a contentname attribute and is being inserted into a template
139457-
element with a valid contentmethod attribute, find the target element with the same namespace,
139458-
localName, and a contentname attribute with the same value.</p></li>
139508+
<li><p>Let <var>scope</var> be the <code>template</code> element's parent.</p></li>
139459139509

139460-
<li><p>TODO: is there any whitespace stripping in contentname attribute values?</p></li>
139510+
<li><p>If <var>scope</var> is a <code>body</code> element, set <var>scope</var> to its
139511+
parent.</p></li>
139461139512

139462-
<li><p>If the template element is in <code>body</code>, instead search the whole document so
139463-
that things in <code>head</code> can be patched.</p></li>
139513+
<li><p>Let <var>target</var> be the first element in tree-order within <var>scope</var> with
139514+
a <code data-x="attr-contentname">contentname</code> attribute exactly matching that of
139515+
<var>element</var>.</p></li>
139464139516

139465-
<li><p>Return if the target element wasn't found</p></li>
139517+
<li><p>If <var>target</var> is null, TODO and return.</p></li>
139466139518

139467-
<li><p>Depending on the contentmethod state, remove existing nodes and update the insertion point.</p></li>
139519+
<li><p>If <var>target</var> doesn't have the same namespace and localName as <var>element</var>,
139520+
TODO and return.</p></li>
139468139521

139469-
<li><p>Question: do we adjust the insertion point simply by setting <var>adjusted insertion location</var>,
139470-
or is there other bookkeeping that's needed here?</p></li>
139471-
</ol>
139472-
</li>
139522+
<li>
139523+
<p>Set the <code>template</code> element's "contentmethod target" to <var>target</var>.</p>
139473139524

139474-
<li><p>Let the <var>adjusted insertion location</var> be the <span>appropriate place for
139475-
inserting a node</span>.</p></li>
139525+
<p class="note">The "contentmethod target" will be used later when nodes are to be inserted
139526+
into the child of the template element that has a contentname attribute.</p>
139527+
</li>
139476139528

139477-
<li><p>If it is not possible to insert <var>element</var> at the <var>adjusted insertion
139478-
location</var>, abort these steps.</p></li>
139529+
<li>
139530+
<p>Depending on the <code data-x="attr-template-contentmethod">contentmethod</code> attribute
139531+
state, potentially remove <var>target</var> or its children and adjust the
139532+
<code>template</code> element's "contentmethod target" and additionally keep track of the
139533+
element we should insert before for the "prepend" and "replace" modes.</p>
139479139534

139480-
<li><p>If the parser was not created as part of the <span>HTML fragment parsing
139481-
algorithm</span>, then push a new <span>element queue</span> onto <var>element</var>'s
139482-
<span>relevant agent</span>'s <span>custom element reactions stack</span>.</p></li>
139535+
<p class="XXX">Should we still insert the element in the following steps? Does it matter?</p>
139536+
</li>
139537+
</ol>
139538+
</li>
139483139539

139484139540
<li><p>Insert <var>element</var> at the <var>adjusted insertion location</var>.</p></li>
139485139541

@@ -140290,8 +140346,7 @@ document.body.appendChild(text);
140290140346

140291140347
<ol>
140292140348
<li><p>TODO: what to we need to do so that elements are inserted into the template element
140293-
and redirected by our pre-insertion steps? We need to undo whatever it is that causes nodes
140294-
to be inserted into the DocumentFragment normally.</p></li>
140349+
and redirected by our pre-insertion steps?</p></li>
140295140350
</ol>
140296140351
</li>
140297140352

@@ -152811,7 +152866,7 @@ interface <dfn interface>External</dfn> {
152811152866
"<code data-x="attr-contentmethod-prepend">prepend</code>"
152812152867
<tr>
152813152868
<th> <code data-x="">contentname</code>
152814-
<td> <span data-x="attr-id">HTML elements</span>
152869+
<td> <span data-x="attr-contentname">HTML elements</span>
152815152870
<td> Unique string to target what contentmethod affects <!-- TODO better words -->
152816152871
<td> <a href="#attribute-text">Text</a>*
152817152872
<tr>

0 commit comments

Comments
 (0)