@@ -22,6 +22,8 @@ urlPrefix: https://www.w3.org/TR/xml-names/#NT-
2222 text: QName; url: QName
2323url: 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
2527type: interface
2628 url: https://w3c.github.io/touch-events/#idl-def-touchevent
2729 text: TouchEvent
@@ -3034,6 +3036,14 @@ optional <i>suppress observers flag</i>, run these steps:
30343036 <li><p> For each <a>live range</a> whose <a for=range>end node</a> is an <a>inclusive descendant</a>
30353037 of <var> node</var> , set its <a for=range>end</a> to (<var> parent</var> , <var> index</var> ).
30363038
3039+ <li><p> For each <a>composed live range</a> whose <a for=range>start node</a> is a
3040+ <a>shadow-including inclusive descendant</a> of <var> node</var> , set its <a for=range>start</a> to
3041+ (<var> parent</var> , <var> index</var> ).
3042+
3043+ <li><p> For each <a>composed live range</a> whose <a for=range>end node</a> is an
3044+ <a>shadow-including inclusive descendant</a> of <var> node</var> , set its <a for=range>end</a> to
3045+ (<var> parent</var> , <var> index</var> ).
3046+
30373047 <li><p> For each <a>live range</a> whose <a for=range>start node</a> is <var> parent</var> and
30383048 <a for=range>start offset</a> is greater than <var> index</var> , decrease its
30393049 <a for=range>start offset</a> by 1.
@@ -5775,7 +5785,8 @@ are:
57755785<hr>
57765786
57775787<p> The <dfn method for=Document><code>createRange()</code></dfn> method steps are to return a new
5778- <a>live range</a> with (<a>this</a> , 0) as its <a for=range>start</a> an <a for=range>end</a> .
5788+ {{Range}} <a>live range</a> with (<a>this</a> , 0) as its <a for=range>start</a> and <a
5789+ for=range> end</a> .
57795790
57805791<p class=note> The {{Range/Range()}} constructor can be used instead.
57815792
@@ -7910,11 +7921,11 @@ range.setEnd(secondText, 4)
79107921<a>node tree</a> above cannot be represented by a <a>range</a> . <a>Ranges</a> are only useful for
79117922<a for=/>nodes</a> .
79127923
7913- <p> {{Range}} objects, unlike {{StaticRange}} objects, are affected by mutations to the
7914- <a>node tree</a> . Therefore they are also known as <a>live ranges</a> . Such mutations will not
7915- invalidate them and will try to ensure that it still represents the same piece of content.
7916- Necessarily, a <a>live range</a> might itself be modified as part of the mutation to the
7917- <a>node tree</a> when, e.g., part of the content it represents is mutated.
7924+ <p> {{Range}} objects, unlike {{StaticRange}} objects, are affected by mutations to the <a>node
7925+ tree</a> . Therefore they are <a>live ranges</a> . Such mutations will not invalidate them and will
7926+ try to ensure that it still represents the same piece of content. Necessarily, a <a>live range</a>
7927+ might itself be modified as part of the mutation to the <a>node tree</a> when, e.g., part of the
7928+ content it represents is mutated.
79187929
79197930<p class=note> See the <a for=/>insert</a> and <a for=/>remove</a> algorithms, the
79207931{{Node/normalize()}} method, and the <a>replace data</a> and <a lt="split a Text node">split</a>
@@ -8141,12 +8152,22 @@ interface Range : AbstractRange {
81418152};
81428153</pre>
81438154
8144- <p> Objects implementing the {{Range}} interface are known as
8145- <dfn export id=concept-live-range>live ranges</dfn> .
8155+ <p> A <dfn export id=concept-live-range>live range</dfn> is a <a>range</a> that is affected by
8156+ mutations to the <a>node tree</a> .</p>
8157+
8158+ <p> Objects implementing the {{Range}} interface are <a>live ranges</a> .
81468159
81478160<p class=note> Algorithms that modify a <a>tree</a> (in particular the <a for=/>insert</a> ,
81488161<a for=/>remove</a> , <a>replace data</a> , and <a lt="split a Text node">split</a> algorithms) modify
8149- <a>live ranges</a> associated with that <a>tree</a> .
8162+ <a>live ranges</a> associated with that <a>tree</a> .</p>
8163+
8164+ <p> A <dfn export id=concept-composed-live-range>composed live range</dfn> is a <a>live range</a>
8165+ that has one associated {{Range}} object - <dfn export
8166+ id=concept-composed-live-range-cached-live-range for="composed live range"> cached live
8167+ range</dfn> .</p>
8168+
8169+ <p class=note> The <a>cached live range</a> is used to maintain backward compatibility with the
8170+ {{getRangeAt}} API.</p>
81508171
81518172<p> The <dfn export id=concept-range-root for="live range">root</dfn> of a <a>live range</a> is the
81528173<a for=tree>root</a> of its <a for=range>start node</a> .
@@ -8216,7 +8237,7 @@ but not its <a for=range>end node</a>, or vice versa.
82168237
82178238<dl class=domintro>
82188239 <dt><code><var> range</var> = new <a constructor>Range()</a> </code>
8219- <dd> Returns a new <a>live range</a> .
8240+ <dd> Returns a new {{Range}} <a>live range</a> .
82208241</dl>
82218242
82228243<p> The <dfn constructor for=Range lt="Range()"><code>new Range()</code></dfn> constructor steps are
@@ -8281,6 +8302,10 @@ steps:
82818302
82828303 <li> Set <var> range</var> 's
82838304 <a for=range>start</a> to <var> bp</var> .
8305+
8306+ <li> If <var> range</var> is the associated <a>cached live range</a> of a <a>composed live
8307+ range</a> <var> composed live range</var> , set <var> composed live range</var> ’s <a
8308+ for="range"> start</a> to <var> bp</var> .
82848309 </ol>
82858310 <dt> If these steps were invoked as "set the end"
82868311 <dd>
@@ -8296,6 +8321,10 @@ steps:
82968321
82978322 <li> Set <var> range</var> 's
82988323 <a for=range>end</a> to <var> bp</var> .
8324+
8325+ <li> If <var> range</var> is the associated <a>cached live range</a> of a <a>composed live range</a>
8326+ <var> composed live range</var> , set <var> composed live range</var> ’s <a for="range">end</a> to
8327+ <var> bp</var> .
82998328 </ol>
83008329 </dl>
83018330</ol>
@@ -8576,8 +8605,8 @@ method steps are:
85768605 (<var> new node</var> , <var> new offset</var> ).
85778606</ol>
85788607
8579- <p> To <dfn export id=concept-range-extract for="live range">extract</dfn> a <a>live range</a>
8580- <var> range</var> , run these steps:
8608+ <p> To <dfn export id=concept-range-extract for="live range">extract</dfn> a {{Range}} <a>live
8609+ range</a> <var> range</var> , run these steps:
85818610
85828611<ol>
85838612 <li><p> Let <var> fragment</var> be a new {{DocumentFragment}} <a for=/>node</a> whose
@@ -8753,7 +8782,7 @@ method steps are:
87538782 <li> <a>Append</a> <var> clone</var>
87548783 to <var> fragment</var> .
87558784
8756- <li> Let <var> subrange</var> be a new <a>live range</a>
8785+ <li> Let <var> subrange</var> be a new {{Range}} <a>live range</a>
87578786 whose <a for=range>start</a> is
87588787 (<var> original start node</var> , <var> original start offset</var> ) and
87598788 whose <a for=range>end</a> is
@@ -8807,7 +8836,7 @@ method steps are:
88078836 <li> <a>Append</a> <var> clone</var>
88088837 to <var> fragment</var> .
88098838
8810- <li> Let <var> subrange</var> be a new <a>live range</a>
8839+ <li> Let <var> subrange</var> be a new {{Range}} <a>live range</a>
88118840 whose <a for=range>start</a> is
88128841 (<var> last partially contained child</var> , 0) and whose
88138842 <a for=range>end</a> is
@@ -8832,7 +8861,7 @@ result of <a for="live range">extracting</a> <a>this</a>.
88328861
88338862<p> To
88348863<dfn export id=concept-range-clone for="live range" lt="clone the contents|cloning the contents">clone the contents</dfn>
8835- of a <a>live range</a> <var> range</var> , run these steps:
8864+ of a {{Range}} <a>live range</a> <var> range</var> , run these steps:
88368865
88378866<ol>
88388867 <li><p> Let <var> fragment</var> be a new {{DocumentFragment}} <a for=/>node</a> whose
@@ -8960,7 +8989,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
89608989 <li> <a>Append</a> <var> clone</var>
89618990 to <var> fragment</var> .
89628991
8963- <li> Let <var> subrange</var> be a new <a>live range</a>
8992+ <li> Let <var> subrange</var> be a new {{Range}} <a>live range</a>
89648993 whose <a for=range>start</a> is
89658994 (<var> original start node</var> , <var> original start offset</var> ) and
89668995 whose <a for=range>end</a> is
@@ -9018,7 +9047,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
90189047 <li> <a>Append</a> <var> clone</var>
90199048 to <var> fragment</var> .
90209049
9021- <li> Let <var> subrange</var> be a new <a>live range</a>
9050+ <li> Let <var> subrange</var> be a new {{Range}} <a>live range</a>
90229051 whose <a for=range>start</a> is
90239052 (<var> last partially contained child</var> , 0) and whose
90249053 <a for=range>end</a> is
@@ -9038,7 +9067,7 @@ of a <a>live range</a> <var>range</var>, run these steps:
90389067result of <a for="live range">cloning the contents</a> of <a>this</a> .
90399068
90409069<p> To <dfn export id=concept-range-insert for="live range">insert</dfn> a <a for=/>node</a>
9041- <var> node</var> into a <a>live range</a> <var> range</var> , run these steps:
9070+ <var> node</var> into a {{Range}} <a>live range</a> <var> range</var> , run these steps:
90429071
90439072<ol>
90449073 <li> If <var> range</var> 's <a for=range>start node</a> is a {{ProcessingInstruction}} or {{Comment}}
@@ -9188,7 +9217,8 @@ check first thing, which matches everyone but Firefox.
91889217</ol>
91899218
91909219<p> The <dfn method for=Range><code>cloneRange()</code></dfn> method steps are to return a new
9191- <a>live range</a> with the same <a for=range>start</a> and <a for=range>end</a> as <a>this</a> .
9220+ {{Range}} <a>live range</a> with the same <a for=range>start</a> and <a for=range>end</a> as
9221+ <a>this</a> .
91929222
91939223<p> The <dfn method for=Range><code>detach()</code></dfn> method steps are to do nothing.
91949224<span class=note> Its functionality (disabling a {{Range}} object) was removed, but the method itself
@@ -10441,6 +10471,7 @@ David Håsäther,
1044110471David Hyatt,
1044210472Deepak Sherveghar,
1044310473Dethe Elza,
10474+ Di Zhang,
1044410475Dimitri Glazkov,
1044510476Domenic Denicola,
1044610477Dominic Cooney,
0 commit comments