@@ -7553,6 +7553,15 @@ Necessarily, a <a>live range</a> might itself be modified as part of the mutatio
7553
7553
{{Node/normalize()}} method, and the <a>replace data</a> and <a lt="split a Text node">split</a>
7554
7554
algorithms for the hairy details.
7555
7555
7556
+ <p> Updating <a>live ranges</a> in response to <a>node tree</a> mutations can be expensive. For every
7557
+ <a>node tree</a> change, all affected {{Range}} objects need to be updated. Even if the application
7558
+ is uninterested in some <a>live ranges</a> , it still has to pay the cost of keeping them up-to-date
7559
+ when a mutation occurs.
7560
+
7561
+ <p> A {{StaticRange}} object is a lightweight <a>range</a> that does not update when the
7562
+ <a>node tree</a> mutates. It is therefore not subject to the same maintenance cost as
7563
+ <a>live ranges</a> .
7564
+
7556
7565
7557
7566
<h3 id=boundary-points>Boundary points</h3>
7558
7567
@@ -7673,13 +7682,41 @@ false otherwise.
7673
7682
<h3 id=interface-staticrange>Interface {{StaticRange}}</h3>
7674
7683
7675
7684
<pre class=idl>
7676
- [Exposed=Window]
7685
+ dictionary StaticRangeInit {
7686
+ required Node startContainer;
7687
+ required unsigned long startOffset;
7688
+ required Node endContainer;
7689
+ required unsigned long endOffset;
7690
+ };
7691
+
7692
+ [Constructor(StaticRangeInit init),
7693
+ Exposed=Window]
7677
7694
interface StaticRange : AbstractRange {
7678
7695
};
7679
7696
</pre>
7680
7697
7681
- <p class=note> A future version of the {{StaticRange}} interface will provide a non-throwing
7682
- constructor.
7698
+ <dl class=domintro>
7699
+ <dt><code><var> staticRange</var> = new <a constructor lt="StaticRange(init)">StaticRange</a> (init)</code>
7700
+ <dd><p> Returns a new <a>range</a> object that does not update when the <a>node tree</a> mutates.
7701
+ </dl>
7702
+
7703
+ <p> The <dfn constructor for=StaticRange><code>StaticRange(<var>init</var>)</code></dfn> constructor,
7704
+ when invoked, must run these steps:
7705
+
7706
+ <ol>
7707
+ <li><p> If <var> init</var> 's {{StaticRangeInit/startContainer}} or {{StaticRangeInit/endContainer}}
7708
+ is a {{DocumentType}} or {{Attr}} <a for=/>node</a> , then <a>throw</a> an
7709
+ "{{InvalidNodeTypeError!!exception}} " {{DOMException}} .
7710
+
7711
+ <li><p> Let <var> staticRange</var> be a new {{StaticRange}} object.
7712
+
7713
+ <li><p> Set <var> staticRange</var> 's <a for=range>start</a> to (<var>init</var>' s
7714
+ {{StaticRangeInit/startContainer}} , <var> init</var> 's {{StaticRangeInit/startOffset}} ) and
7715
+ <a for=range>end</a> to (<var> init</var> 's {{StaticRangeInit/endContainer}}, <var>init</var>' s
7716
+ {{StaticRangeInit/endOffset}} ).
7717
+
7718
+ <li><p> Return <var> staticRange</var> .
7719
+ </ol>
7683
7720
7684
7721
7685
7722
<h3 id=interface-range>Interface {{Range}}</h3>
@@ -10100,6 +10137,7 @@ Ryosuke Niwa,
10100
10137
Sam Dutton,
10101
10138
Sam Sneddon,
10102
10139
Samuel Giles,
10140
+ Sanket Joshi,
10103
10141
Sebastian Mayr,
10104
10142
Seo Sanghyeon,
10105
10143
Sergey G. Grekhov,
0 commit comments