Skip to content

Commit

Permalink
Editorial: expose Node's textContent getter and setter steps
Browse files Browse the repository at this point in the history
These will be used by the Trusted Types (and eventually HTML once upstreamed) as part of shadowing this attribute to HTMLScriptElement.
  • Loading branch information
lukewarlow committed Apr 3, 2024
1 parent 68df785 commit 5858d35
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4286,24 +4286,27 @@ empty string instead, and then do as described below, switching on the interface
<dd><p>Do nothing.
</dl>

<p>The <dfn attribute for=Node><code>textContent</code></dfn> getter steps are to return the
following, switching on the interface <a>this</a> <a>implements</a>:
<p>To <dfn export>get text content</dfn> with a <a for=/>node</a> <var>node</var>,
return the following, switching on the interface <var>node</var> <a>implements</a>:

<dl class=switch>
<dt>{{DocumentFragment}}
<dt>{{Element}}
<dd>The <a>descendant text content</a> of <a>this</a>.
<dd>The <a>descendant text content</a> of <var>node</var>.

<dt>{{Attr}}
<dd><a>this</a>'s <a for=Attr>value</a>.
<dd><var>node</var>'s <a for=Attr>value</a>.

<dt>{{CharacterData}}
<dd><a>this</a>'s <a for=CharacterData>data</a>.
<dd><var>node</var>'s <a for=CharacterData>data</a>.

<dt>Otherwise
<dd>Null.
</dl>

<p>The <dfn attribute for=Node><code>textContent</code></dfn> getter steps are to
return the result of running <a>get text content</a> with <a>this</a>.

<p>To <dfn export>string replace all</dfn> with a string <var>string</var> within a
<a for=/>node</a> <var>parent</var>, run these steps:

Expand All @@ -4317,26 +4320,28 @@ following, switching on the interface <a>this</a> <a>implements</a>:
<li><p><a for=Node>Replace all</a> with <var>node</var> within <var>parent</var>.
</ol>

<p>The {{Node/textContent}} setter steps are to, if the given value is null, act as if it was the
empty string instead, and then do as described below, switching on the interface <a>this</a>
<a>implements</a>:
<p>To <dfn export>set text content</dfn> with a <a for=/>node</a> <var>node</var> and a string <var>value</var>,
do as defined below, switching on the interface <var>node</var> <a>implements</a>:

<dl class=switch>
<dt>{{DocumentFragment}}
<dt>{{Element}}
<dd><p><a>String replace all</a> with the given value within <a>this</a>.
<dd><p><a>String replace all</a> with <var>value</var> within <var>node</var>.

<dt>{{Attr}}
<dd><p><a>Set an existing attribute value</a> with <a>this</a> and the given value.
<dd><p><a>Set an existing attribute value</a> with <var>node</var> and <var>value</var>.

<dt>{{CharacterData}}
<dd><p><a>Replace data</a> with node <a>this</a>, offset 0, count <a>this</a>'s
<a for=Node>length</a>, and data the given value.
<dd><p><a>Replace data</a> with node <var>node</var>, offset 0, count <var>node</var>'s
<a for=Node>length</a>, and data <var>value</var>.

<dt>Otherwise
<dd><p>Do nothing.
</dl>

<p>The {{Node/textContent}} setter steps are to, if the given value is null, act as if it was the
empty string instead, and then run <a>set text content</a> with <a>this</a> and the given value.

<hr>

<dl class=domintro>
Expand Down

0 comments on commit 5858d35

Please sign in to comment.