@@ -22,6 +22,8 @@ urlPrefix: https://www.w3.org/TR/xml-names/#NT-
22
22
text: QName; url: QName
23
23
url: https://w3c.github.io/DOM-Parsing/#dom-range-createcontextualfragment
24
24
type: method; text: createContextualFragment(); for: Range
25
+ url: https://w3c.github.io/selection-api/#dom-selection-getrangeat
26
+ type: method; text: getRangeAt(); for: Range
25
27
type: interface
26
28
url: https://w3c.github.io/touch-events/#idl-def-touchevent
27
29
text: TouchEvent
@@ -3027,6 +3029,14 @@ optional <i>suppress observers flag</i>, run these steps:
3027
3029
<li><p> For each <a>live range</a> whose <a for=range>end node</a> is an <a>inclusive descendant</a>
3028
3030
of <var> node</var> , set its <a for=range>end</a> to (<var> parent</var> , <var> index</var> ).
3029
3031
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
+
3030
3040
<li><p> For each <a>live range</a> whose <a for=range>start node</a> is <var> parent</var> and
3031
3041
<a for=range>start offset</a> is greater than <var> index</var> , decrease its
3032
3042
<a for=range>start offset</a> by 1.
@@ -5743,7 +5753,8 @@ are:
5743
5753
<hr>
5744
5754
5745
5755
<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> .
5747
5758
5748
5759
<p class=note> The {{Range/Range()}} constructor can be used instead.
5749
5760
@@ -7878,11 +7889,11 @@ range.setEnd(secondText, 4)
7878
7889
<a>node tree</a> above cannot be represented by a <a>range</a> . <a>Ranges</a> are only useful for
7879
7890
<a for=/>nodes</a> .
7880
7891
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.
7886
7897
7887
7898
<p class=note> See the <a for=/>insert</a> and <a for=/>remove</a> algorithms, the
7888
7899
{{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 {
8109
8120
};
8110
8121
</pre>
8111
8122
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> .
8114
8127
8115
8128
<p class=note> Algorithms that modify a <a>tree</a> (in particular the <a for=/>insert</a> ,
8116
8129
<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>
8118
8139
8119
8140
<p> The <dfn export id=concept-range-root for="live range">root</dfn> of a <a>live range</a> is the
8120
8141
<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.
8184
8205
8185
8206
<dl class=domintro>
8186
8207
<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> .
8188
8209
</dl>
8189
8210
8190
8211
<p> The <dfn constructor for=Range lt="Range()"><code>new Range()</code></dfn> constructor steps are
@@ -8249,6 +8270,10 @@ steps:
8249
8270
8250
8271
<li> Set <var> range</var> 's
8251
8272
<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> .
8252
8277
</ol>
8253
8278
<dt> If these steps were invoked as "set the end"
8254
8279
<dd>
@@ -8264,6 +8289,10 @@ steps:
8264
8289
8265
8290
<li> Set <var> range</var> 's
8266
8291
<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> .
8267
8296
</ol>
8268
8297
</dl>
8269
8298
</ol>
@@ -8544,8 +8573,8 @@ method steps are:
8544
8573
(<var> new node</var> , <var> new offset</var> ).
8545
8574
</ol>
8546
8575
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:
8549
8578
8550
8579
<ol>
8551
8580
<li><p> Let <var> fragment</var> be a new {{DocumentFragment}} <a for=/>node</a> whose
@@ -8721,7 +8750,7 @@ method steps are:
8721
8750
<li> <a>Append</a> <var> clone</var>
8722
8751
to <var> fragment</var> .
8723
8752
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>
8725
8754
whose <a for=range>start</a> is
8726
8755
(<var> original start node</var> , <var> original start offset</var> ) and
8727
8756
whose <a for=range>end</a> is
@@ -8775,7 +8804,7 @@ method steps are:
8775
8804
<li> <a>Append</a> <var> clone</var>
8776
8805
to <var> fragment</var> .
8777
8806
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>
8779
8808
whose <a for=range>start</a> is
8780
8809
(<var> last partially contained child</var> , 0) and whose
8781
8810
<a for=range>end</a> is
@@ -8800,7 +8829,7 @@ result of <a for="live range">extracting</a> <a>this</a>.
8800
8829
8801
8830
<p> To
8802
8831
<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:
8804
8833
8805
8834
<ol>
8806
8835
<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:
8928
8957
<li> <a>Append</a> <var> clone</var>
8929
8958
to <var> fragment</var> .
8930
8959
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>
8932
8961
whose <a for=range>start</a> is
8933
8962
(<var> original start node</var> , <var> original start offset</var> ) and
8934
8963
whose <a for=range>end</a> is
@@ -8986,7 +9015,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
8986
9015
<li> <a>Append</a> <var> clone</var>
8987
9016
to <var> fragment</var> .
8988
9017
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>
8990
9019
whose <a for=range>start</a> is
8991
9020
(<var> last partially contained child</var> , 0) and whose
8992
9021
<a for=range>end</a> is
@@ -9006,7 +9035,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
9006
9035
result of <a for="live range">cloning the contents</a> of <a>this</a> .
9007
9036
9008
9037
<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:
9010
9039
9011
9040
<ol>
9012
9041
<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.
9156
9185
</ol>
9157
9186
9158
9187
<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> .
9160
9190
9161
9191
<p> The <dfn method for=Range><code>detach()</code></dfn> method steps are to do nothing.
9162
9192
<span class=note> Its functionality (disabling a {{Range}} object) was removed, but the method itself
@@ -10408,6 +10438,7 @@ David Håsäther,
10408
10438
David Hyatt,
10409
10439
Deepak Sherveghar,
10410
10440
Dethe Elza,
10441
+ Di Zhang,
10411
10442
Dimitri Glazkov,
10412
10443
Domenic Denicola,
10413
10444
Dominic Cooney,
0 commit comments