Skip to content

Commit ce4c6ba

Browse files
authored
Replace child text content change steps
It needs to be "children changed steps" as consumers appear to react to changes of all sorts. Tests: web-platform-tests/wpt#15871. This builds on work started in #732 and will further refine that eventually. Meta follow-up: #802.
1 parent 49f009a commit ce4c6ba

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

dom.bs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ urlPrefix: https://tc39.github.io/ecma262/#; spec: ECMASCRIPT
3333
type: dfn
3434
text: Realm; url: realm
3535
text: surrounding agent; url: surrounding-agent
36-
urlPrefix: https://w3c.github.io/hr-time/#; spec: HR-TIME
36+
urlPrefix: https://w3c.github.io/hr-time/#; spec: HR-TIME-2
3737
type:typedef; urlPrefix: dom-; text: DOMHighResTimeStamp
3838
type:dfn; text: time origin; url: dfn-time-origin
3939
type:dfn; text: clock resolution
@@ -967,7 +967,7 @@ correct defaults.</p>
967967

968968
<p class=warning>User agents should set a minimum resolution of <var>event</var>'s
969969
{{Event/timeStamp}} attribute to 5 microseconds following the existing <a>clock resolution</a>
970-
recommendation. [[!HR-TIME]]
970+
recommendation. [[!HR-TIME-2]]
971971

972972
<li><p><a for=map>For each</a> <var>member</var><var>value</var> in <var>dictionary</var>, if
973973
<var>event</var> has an attribute whose <a spec=webidl>identifier</a> is <var>member</var>, then
@@ -2421,6 +2421,11 @@ algorithm below.
24212421
adjust this further based on the requirements of the script element. There might be other ways
24222422
to define that though as Olli suggests, so leaving that out for now. -->
24232423

2424+
<p><a lt="other applicable specifications">Specifications</a> may define
2425+
<dfn export id=concept-node-children-changed-ext>children changed steps</dfn> for all or some
2426+
<a for=/>nodes</a>. The algorithm is passed no argument and is called from <a for=/>insert</a>,
2427+
<a for=/>remove</a>, and <a for=/>replace data</a>.
2428+
24242429
<p>To <dfn export id=concept-node-insert>insert</dfn> a <var>node</var> into a <var>parent</var>
24252430
before a <var>child</var>, with an optional <i>suppress observers flag</i>, run these steps:
24262431

@@ -2476,9 +2481,6 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24762481
<li><p>If <var>parent</var> is a <a for=Element>shadow host</a> and <var>node</var> is a
24772482
<a>slotable</a>, then <a>assign a slot</a> for <var>node</var>.
24782483

2479-
<li>If <var>node</var> is a {{Text}} node, run the <a>child text content change steps</a> for
2480-
<var>parent</var>.
2481-
24822484
<li><p>If <var>parent</var>'s <a for=tree>root</a> is a <a for=/>shadow root</a>, and
24832485
<var>parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list,
24842486
then run <a>signal a slot change</a> for <var>parent</var>.
@@ -2515,6 +2517,8 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
25152517

25162518
<li><p>If <i>suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
25172519
<var>parent</var> with <var>nodes</var>, « », <var>previousSibling</var>, and <var>child</var>.
2520+
2521+
<li><p>Run the <a>children changed steps</a> for <var>parent</var>.
25182522
</ol>
25192523

25202524

@@ -2779,8 +2783,7 @@ with an optional <i>suppress observers flag</i>, run these steps:
27792783
<var>parent</var> with « », « <var>node</var> », <var>oldPreviousSibling</var>, and
27802784
<var>oldNextSibling</var>.
27812785

2782-
<li><p>If <var>node</var> is a {{Text}} node, then run the <a>child text content change steps</a>
2783-
for <var>parent</var>.
2786+
<li><p>Run the <a>children changed steps</a> for <var>parent</var>.
27842787
</ol>
27852788

27862789

@@ -4243,10 +4246,6 @@ steps for each <a>descendant</a> <a>exclusive <code>Text</code> node</a> <var>no
42434246
(excluding itself), in <a>tree order</a>.
42444247
</ol>
42454248

4246-
<p class="note">{{Node/normalize()}} does not need to run any
4247-
<a>child text content change steps</a>, since although it messes with {{Text}} nodes extensively, it
4248-
does so specifically in a way that preserves the <a>child text content</a>.
4249-
42504249
<hr>
42514250

42524251
<dl class=domintro>
@@ -7252,8 +7251,8 @@ To <dfn export id=concept-cd-replace>replace data</dfn> of node <var>node</var>
72527251
<a for=range>end offset</a> by <var>data</var>'s <a for="JavaScript string">length</a> and decrease
72537252
it by <var>count</var>.
72547253

7255-
<li>If <var>node</var> is a {{Text}} node and its <a>parent</a> is not null, run the
7256-
<a>child text content change steps</a> for <var>node</var>'s <a>parent</a>.
7254+
<li>If <var>node</var>'s <a>parent</a> is non-null, then run the <a>children changed steps</a> for
7255+
<var>node</var>'s <a>parent</a>.
72577256
</ol>
72587257
<!-- delete happens after insert for better cursor positioning with editing
72597258
https://www.w3.org/Bugs/Public/show_bug.cgi?id=13153 -->
@@ -7390,10 +7389,6 @@ if any, and its <a>contiguous exclusive <code>Text</code> nodes</a>, and <var>no
73907389
<var>node</var> is the <a for=string>concatenation</a> of the <a for=CharacterData>data</a> of all
73917390
the {{Text}} <a for=/>node</a> <a>children</a> of <var>node</var>, in <a>tree order</a>.
73927391

7393-
<p>This and <a lt="other applicable specifications">other specifications</a> may define
7394-
<dfn export id=concept-node-text-change-ext>child text content change steps</dfn> for
7395-
<a for=/>nodes</a>.
7396-
73977392
<p>The <dfn export id=concept-descendant-text-content>descendant text content</dfn> of a
73987393
<a for=/>node</a> <var>node</var> is the <a for=string>concatenation</a> of the
73997394
<a for=CharacterData>data</a> of all the {{Text}} <a for=/>node</a> <a>descendants</a> of

0 commit comments

Comments
 (0)