Skip to content

Commit 17ddc93

Browse files
committed
Editorial: refactor innerText
1 parent 73ece48 commit 17ddc93

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

source

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12272,12 +12272,11 @@ interface <dfn>DOMStringMap</dfn> {
1227212272
</div>
1227312273

1227412274

12275-
<h4>The <code data-x="dom-innerText">innerText</code> IDL attribute</h4>
12275+
<h4 id="the-innertext-idl-attribute">The <code data-x="dom-innerText">innerText</code> getter and
12276+
setter</h4>
1227612277

1227712278
<dl class="domintro">
12278-
1227912279
<dt><var>element</var> . <code subdfn data-x="dom-innerText">innerText</code> [ = <var>value</var> ]</dt>
12280-
1228112280
<dd>
1228212281
<p>Returns the element's text content "as rendered".</p>
1228312282

@@ -12287,16 +12286,15 @@ interface <dfn>DOMStringMap</dfn> {
1228712286

1228812287
<div w-nodev>
1228912288

12290-
<p>On getting, the <dfn><code data-x="dom-innerText">innerText</code></dfn> attribute must follow
12291-
these steps:</p>
12289+
<p>The <dfn><code data-x="dom-innerText">innerText</code></dfn> getter steps are:</p>
1229212290

1229312291
<ol>
1229412292
<li>
12295-
<p>If this element is not <span>being rendered</span>, or if the user agent is a non-CSS user
12296-
agent, then return this element's <span>descendant text content</span>.</p>
12293+
<p>If <span>this</span> is not <span>being rendered</span> or if the user agent is a non-CSS
12294+
user agent, then return <span>this</span>'s <span>descendant text content</span>.</p>
1229712295

1229812296
<p class="note">This step can produce surprising results, as when the <code
12299-
data-x="dom-innerText">innerText</code> attribute is accessed on an element not <span>being
12297+
data-x="dom-innerText">innerText</code> getter is invoked on an element not <span>being
1230012298
rendered</span>, its text contents are returned, but when accessed on an element that is
1230112299
<span>being rendered</span>, all of its children that are not <span>being rendered</span> have
1230212300
their text contents ignored.</p>
@@ -12305,7 +12303,7 @@ interface <dfn>DOMStringMap</dfn> {
1230512303
<li><p>Let <var>results</var> be a new empty <span>list</span>.</p></li>
1230612304

1230712305
<li>
12308-
<p>For each child node <var>node</var> of this element:</p>
12306+
<p>For each child node <var>node</var> of <span>this</span>:</p>
1230912307

1231012308
<ol>
1231112309
<li><p>Let <var>current</var> be the <span>list</span> resulting in running the <span>inner
@@ -12419,11 +12417,10 @@ interface <dfn>DOMStringMap</dfn> {
1241912417
stringifier and maybe expose it directly on <span data-x="concept-range">ranges</span>. See <a
1242012418
href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=10583">Bugzilla bug 10583</a>.</p>
1242112419

12422-
<p>On setting, the <code data-x="dom-innerText">innerText</code> attribute must follow these
12423-
steps:</p>
12420+
<p>The <code data-x="dom-innerText">innerText</code> setter steps are:</p>
1242412421

1242512422
<ol>
12426-
<li><p>Let <var>document</var> be this element's <span>node document</span>.</p></li>
12423+
<li><p>Let <var>document</var> be <span>this</span>'s <span>node document</span>.</p></li>
1242712424

1242812425
<li><p>Let <var>fragment</var> be a new <code>DocumentFragment</code> object whose <span>node
1242912426
document</span> is <var>document</var>.</p></li>
@@ -12469,7 +12466,7 @@ interface <dfn>DOMStringMap</dfn> {
1246912466
</li>
1247012467

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

1247512472
</div>
@@ -121894,8 +121891,8 @@ INSERT INTERFACES HERE
121894121891
href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">W3C Permissive
121895121892
Document License</a>.</p>
121896121893

121897-
<p>Part of the revision history of the <code data-x="dom-innerText">innerText</code> IDL attribute
121898-
can be found in the <a
121894+
<p>Part of the revision history of the <code data-x="dom-innerText">innerText</code> getter and
121895+
setter can be found in the <a
121899121896
href="https://github.com/rocallahan/innerText-spec"><code>rocallahan/innerText-spec</code>
121900121897
repository</a>.</p>
121901121898

0 commit comments

Comments
 (0)