Skip to content

Commit 8a726bb

Browse files
committed
Add definition for composed live range
1 parent 10dbae4 commit 8a726bb

File tree

1 file changed

+50
-19
lines changed

1 file changed

+50
-19
lines changed

dom.bs

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ urlPrefix: https://www.w3.org/TR/xml-names/#NT-
2222
text: QName; url: QName
2323
url: https://w3c.github.io/DOM-Parsing/#dom-range-createcontextualfragment
2424
type: method; text: createContextualFragment(); for: Range
25+
url: https://w3c.github.io/selection-api/#dom-selection-getrangeat
26+
type: method; text: getRangeAt(); for: Range
2527
type: interface
2628
url: https://w3c.github.io/touch-events/#idl-def-touchevent
2729
text: TouchEvent
@@ -3027,6 +3029,14 @@ optional <i>suppress observers flag</i>, run these steps:
30273029
<li><p>For each <a>live range</a> whose <a for=range>end node</a> is an <a>inclusive descendant</a>
30283030
of <var>node</var>, set its <a for=range>end</a> to (<var>parent</var>, <var>index</var>).
30293031

3032+
<li><p>For each <a>composed live range</a> whose <a for=range>start node</a> is a
3033+
<a>shadow-including inclusive descendant</a> of <var>node</var>, set its <a for=range>start</a> to
3034+
(<var>parent</var>, <var>index</var>).
3035+
3036+
<li><p>For each <a>composed live range</a> whose <a for=range>end node</a> is an
3037+
<a>shadow-including inclusive descendant</a> of <var>node</var>, set its <a for=range>end</a> to
3038+
(<var>parent</var>, <var>index</var>).
3039+
30303040
<li><p>For each <a>live range</a> whose <a for=range>start node</a> is <var>parent</var> and
30313041
<a for=range>start offset</a> is greater than <var>index</var>, decrease its
30323042
<a for=range>start offset</a> by 1.
@@ -5743,7 +5753,8 @@ are:
57435753
<hr>
57445754

57455755
<p>The <dfn method for=Document><code>createRange()</code></dfn> method steps are to return a new
5746-
<a>live range</a> with (<a>this</a>, 0) as its <a for=range>start</a> an <a for=range>end</a>.
5756+
{{Range}} <a>live range</a> with (<a>this</a>, 0) as its <a for=range>start</a> and <a
5757+
for=range>end</a>.
57475758

57485759
<p class=note>The {{Range/Range()}} constructor can be used instead.
57495760

@@ -7878,11 +7889,11 @@ range.setEnd(secondText, 4)
78787889
<a>node tree</a> above cannot be represented by a <a>range</a>. <a>Ranges</a> are only useful for
78797890
<a for=/>nodes</a>.
78807891

7881-
<p>{{Range}} objects, unlike {{StaticRange}} objects, are affected by mutations to the
7882-
<a>node tree</a>. Therefore they are also known as <a>live ranges</a>. Such mutations will not
7883-
invalidate them and will try to ensure that it still represents the same piece of content.
7884-
Necessarily, a <a>live range</a> might itself be modified as part of the mutation to the
7885-
<a>node tree</a> when, e.g., part of the content it represents is mutated.
7892+
<p>{{Range}} objects, unlike {{StaticRange}} objects, are affected by mutations to the <a>node
7893+
tree</a>. Therefore they are <a>live ranges</a>. Such mutations will not invalidate them and will
7894+
try to ensure that it still represents the same piece of content. Necessarily, a <a>live range</a>
7895+
might itself be modified as part of the mutation to the <a>node tree</a> when, e.g., part of the
7896+
content it represents is mutated.
78867897

78877898
<p class=note>See the <a for=/>insert</a> and <a for=/>remove</a> algorithms, the
78887899
{{Node/normalize()}} method, and the <a>replace data</a> and <a lt="split a Text node">split</a>
@@ -8109,12 +8120,22 @@ interface Range : AbstractRange {
81098120
};
81108121
</pre>
81118122

8112-
<p>Objects implementing the {{Range}} interface are known as
8113-
<dfn export id=concept-live-range>live ranges</dfn>.
8123+
<p>A <dfn export id=concept-live-range>live range</dfn> is a <a>range</a> that is affected by
8124+
mutations to the <a>node tree</a>.</p>
8125+
8126+
<p>Objects implementing the {{Range}} interface are <a>live ranges</a>.
81148127

81158128
<p class=note>Algorithms that modify a <a>tree</a> (in particular the <a for=/>insert</a>,
81168129
<a for=/>remove</a>, <a>replace data</a>, and <a lt="split a Text node">split</a> algorithms) modify
8117-
<a>live ranges</a> associated with that <a>tree</a>.
8130+
<a>live ranges</a> associated with that <a>tree</a>.</p>
8131+
8132+
<p>A <dfn export id=concept-composed-live-range>composed live range</dfn> is a <a>live range</a>
8133+
that has one associated {{Range}} object - <dfn export
8134+
id=concept-composed-live-range-cached-live-range for="composed live range">cached live
8135+
range</dfn>.</p>
8136+
8137+
<p class=note>The <a>cached live range</a> is used to maintain backward compatibility with the
8138+
{{getRangeAt}} API.</p>
81188139

81198140
<p>The <dfn export id=concept-range-root for="live range">root</dfn> of a <a>live range</a> is the
81208141
<a for=tree>root</a> of its <a for=range>start node</a>.
@@ -8184,7 +8205,7 @@ but not its <a for=range>end node</a>, or vice versa.
81848205

81858206
<dl class=domintro>
81868207
<dt><code><var>range</var> = new <a constructor>Range()</a></code>
8187-
<dd>Returns a new <a>live range</a>.
8208+
<dd>Returns a new {{Range}} <a>live range</a>.
81888209
</dl>
81898210

81908211
<p>The <dfn constructor for=Range lt="Range()"><code>new Range()</code></dfn> constructor steps are
@@ -8249,6 +8270,10 @@ steps:
82498270

82508271
<li>Set <var>range</var>'s
82518272
<a for=range>start</a> to <var>bp</var>.
8273+
8274+
<li>If <var>range</var> is the associated <a>cached live range</a> of a <a>composed live
8275+
range</a> <var>composed live range</var>, set <var>composed live range</var>’s <a
8276+
for="range">start</a> to <var>bp</var>.
82528277
</ol>
82538278
<dt>If these steps were invoked as "set the end"
82548279
<dd>
@@ -8264,6 +8289,10 @@ steps:
82648289

82658290
<li>Set <var>range</var>'s
82668291
<a for=range>end</a> to <var>bp</var>.
8292+
8293+
<li>If <var>range</var> is the associated <a>cached live range</a> of a <a>composed live range</a>
8294+
<var>composed live range</var>, set <var>composed live range</var>’s <a for="range">end</a> to
8295+
<var>bp</var>.
82678296
</ol>
82688297
</dl>
82698298
</ol>
@@ -8544,8 +8573,8 @@ method steps are:
85448573
(<var>new node</var>, <var>new offset</var>).
85458574
</ol>
85468575

8547-
<p>To <dfn export id=concept-range-extract for="live range">extract</dfn> a <a>live range</a>
8548-
<var>range</var>, run these steps:
8576+
<p>To <dfn export id=concept-range-extract for="live range">extract</dfn> a {{Range}} <a>live
8577+
range</a> <var>range</var>, run these steps:
85498578

85508579
<ol>
85518580
<li><p>Let <var>fragment</var> be a new {{DocumentFragment}} <a for=/>node</a> whose
@@ -8721,7 +8750,7 @@ method steps are:
87218750
<li><a>Append</a> <var>clone</var>
87228751
to <var>fragment</var>.
87238752

8724-
<li>Let <var>subrange</var> be a new <a>live range</a>
8753+
<li>Let <var>subrange</var> be a new {{Range}} <a>live range</a>
87258754
whose <a for=range>start</a> is
87268755
(<var>original start node</var>, <var>original start offset</var>) and
87278756
whose <a for=range>end</a> is
@@ -8775,7 +8804,7 @@ method steps are:
87758804
<li><a>Append</a> <var>clone</var>
87768805
to <var>fragment</var>.
87778806

8778-
<li>Let <var>subrange</var> be a new <a>live range</a>
8807+
<li>Let <var>subrange</var> be a new {{Range}} <a>live range</a>
87798808
whose <a for=range>start</a> is
87808809
(<var>last partially contained child</var>, 0) and whose
87818810
<a for=range>end</a> is
@@ -8800,7 +8829,7 @@ result of <a for="live range">extracting</a> <a>this</a>.
88008829

88018830
<p>To
88028831
<dfn export id=concept-range-clone for="live range" lt="clone the contents|cloning the contents">clone the contents</dfn>
8803-
of a <a>live range</a> <var>range</var>, run these steps:
8832+
of a {{Range}} <a>live range</a> <var>range</var>, run these steps:
88048833

88058834
<ol>
88068835
<li><p>Let <var>fragment</var> be a new {{DocumentFragment}} <a for=/>node</a> whose
@@ -8928,7 +8957,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
89288957
<li><a>Append</a> <var>clone</var>
89298958
to <var>fragment</var>.
89308959

8931-
<li>Let <var>subrange</var> be a new <a>live range</a>
8960+
<li>Let <var>subrange</var> be a new {{Range}} <a>live range</a>
89328961
whose <a for=range>start</a> is
89338962
(<var>original start node</var>, <var>original start offset</var>) and
89348963
whose <a for=range>end</a> is
@@ -8986,7 +9015,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
89869015
<li><a>Append</a> <var>clone</var>
89879016
to <var>fragment</var>.
89889017

8989-
<li>Let <var>subrange</var> be a new <a>live range</a>
9018+
<li>Let <var>subrange</var> be a new {{Range}} <a>live range</a>
89909019
whose <a for=range>start</a> is
89919020
(<var>last partially contained child</var>, 0) and whose
89929021
<a for=range>end</a> is
@@ -9006,7 +9035,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
90069035
result of <a for="live range">cloning the contents</a> of <a>this</a>.
90079036

90089037
<p>To <dfn export id=concept-range-insert for="live range">insert</dfn> a <a for=/>node</a>
9009-
<var>node</var> into a <a>live range</a> <var>range</var>, run these steps:
9038+
<var>node</var> into a {{Range}} <a>live range</a> <var>range</var>, run these steps:
90109039

90119040
<ol>
90129041
<li>If <var>range</var>'s <a for=range>start node</a> is a {{ProcessingInstruction}} or {{Comment}}
@@ -9156,7 +9185,8 @@ check first thing, which matches everyone but Firefox.
91569185
</ol>
91579186

91589187
<p>The <dfn method for=Range><code>cloneRange()</code></dfn> method steps are to return a new
9159-
<a>live range</a> with the same <a for=range>start</a> and <a for=range>end</a> as <a>this</a>.
9188+
{{Range}} <a>live range</a> with the same <a for=range>start</a> and <a for=range>end</a> as
9189+
<a>this</a>.
91609190

91619191
<p>The <dfn method for=Range><code>detach()</code></dfn> method steps are to do nothing.
91629192
<span class=note>Its functionality (disabling a {{Range}} object) was removed, but the method itself
@@ -10408,6 +10438,7 @@ David Håsäther,
1040810438
David Hyatt,
1040910439
Deepak Sherveghar,
1041010440
Dethe Elza,
10441+
Di Zhang,
1041110442
Dimitri Glazkov,
1041210443
Domenic Denicola,
1041310444
Dominic Cooney,

0 commit comments

Comments
 (0)