Skip to content

Commit

Permalink
Editorial: export Element's innerText getter and setter steps
Browse files Browse the repository at this point in the history
These will be used by Trusted Types (and eventually HTML once upstreamed) as part of shadowing this attribute to HTMLScriptElement.
  • Loading branch information
lukewarlow authored Apr 3, 2024
1 parent 70f12d7 commit f55b0b6
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -14310,14 +14310,13 @@ interface <dfn interface>DOMStringMap</dfn> {

<div w-nodev>

<p>The <dfn attribute for="HTMLElement"><code data-x="dom-innerText">innerText</code></dfn> and
<dfn attribute for="HTMLElement"><code data-x="dom-outerText">outerText</code></dfn> getter steps
are:</p>
<p>The <dfn export>get the text steps</dfn>, given an <span>HTMLElement</span>
<var>element</var>, are:</p>

<ol>
<li>
<p>If <span>this</span> is not <span>being rendered</span> or if the user agent is a non-CSS
user agent, then return <span>this</span>'s <span>descendant text content</span>.</p>
<p>If <var>element</var> is not <span>being rendered</span> or if the user agent is a non-CSS
user agent, then return <var>element</var>'s <span>descendant text content</span>.</p>

<p class="note">This step can produce surprising results, as when the <code
data-x="dom-innerText">innerText</code> getter is invoked on an element not <span>being
Expand All @@ -14329,13 +14328,12 @@ interface <dfn interface>DOMStringMap</dfn> {
<li><p>Let <var>results</var> be a new empty <span>list</span>.</p></li>

<li>
<p>For each child node <var>node</var> of <span>this</span>:</p>
<p>For each child node <var>node</var> of <var>element</var>:</p>

<ol>
<li><p>Let <var>current</var> be the <span>list</span> resulting in running the
<span>rendered text collection steps</span> with <var>node</var>. Each item in
<var>results</var> will either be a <span>string</span> or a positive integer (a <i>required
line break count</i>).</p>
<li><p>Let <var>current</var> be the <span>list</span> resulting in running the <span>rendered
text collection steps</span> with <var>node</var>. Each item in <var>results</var> will either
be a <span>string</span> or a positive integer (a <i>required line break count</i>).</p>

<p class="note">Intuitively, a <i>required line break count</i> item means that a certain
number of line breaks appear at that point, but they can be collapsed with the line breaks
Expand All @@ -14360,6 +14358,10 @@ interface <dfn interface>DOMStringMap</dfn> {
<li><p>Return the concatenation of the string items in <var>results</var>.</p></li>
</ol>

<p>The <dfn attribute for="HTMLElement"><code data-x="dom-innerText">innerText</code></dfn> and
<dfn attribute for="HTMLElement"><code data-x="dom-outerText">outerText</code></dfn> getter steps
are to return the result of running <span>get the text steps</span> with <span>this</span>.</p>

<p>The <dfn>rendered text collection steps</dfn>, given a <span>node</span> <var>node</var>,
are as follows:</p>

Expand Down Expand Up @@ -14446,16 +14448,20 @@ interface <dfn interface>DOMStringMap</dfn> {

<hr>

<p>The <code data-x="dom-innerText">innerText</code> setter steps are:</p>
<p>The <dfn export>set the inner text steps</dfn>, given an <span>HTMLElement</span>
<var>element</var>, and a string <var>value</var> are:</p>

<ol>
<li><p>Let <var>fragment</var> be the <span>rendered text fragment</span> for the given value
given <span>this</span>'s <span>node document</span>.</p></li>
<li><p>Let <var>fragment</var> be the <span>rendered text fragment</span> for <var>value</var>
given <var>element</var>'s <span>node document</span>.</p></li>

<li><p><span data-x="concept-node-replace-all">Replace all</span> with <var>fragment</var> within
<span>this</span>.</p></li>
<li><p><span data-x="concept-node-replace-all">Replace all</span> with <var>fragment</var>
within <var>element</var>.</p></li>
</ol>

<p>The <code data-x="dom-innerText">innerText</code> setter steps are to run <span>set the inner
text steps</span>.</p>

<p>The <code data-x="dom-outerText">outerText</code> setter steps are:</p>

<ol>
Expand Down

0 comments on commit f55b0b6

Please sign in to comment.