-
Notifications
You must be signed in to change notification settings - Fork 318
Add definition for composed selection range #1342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
7c48fa5
487cac0
461aed7
413348d
c7f38b1
1f74a51
f5b6935
367288b
fe020ca
4760e78
d8ca5a5
99b212b
700ca5e
1cf2b12
59d9595
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3034,6 +3034,14 @@ optional <i>suppress observers flag</i>, run these steps: | |
| <li><p>For each <a>live range</a> whose <a for=range>end node</a> is an <a>inclusive descendant</a> | ||
| of <var>node</var>, set its <a for=range>end</a> to (<var>parent</var>, <var>index</var>). | ||
|
|
||
| <li><p>For each <a>composed selection range</a> whose <a for=range>start node</a> is a | ||
| <a>shadow-including inclusive descendant</a> of <var>node</var>, set its <a for=range>start</a> to | ||
| (<var>parent</var>, <var>index</var>). | ||
|
|
||
| <li><p>For each <a>composed selection range</a> whose <a for=range>end node</a> is a | ||
| <a>shadow-including inclusive descendant</a> of <var>node</var>, set its <a for=range>end</a> to | ||
| (<var>parent</var>, <var>index</var>). | ||
|
|
||
| <li><p>For each <a>live range</a> whose <a for=range>start node</a> is <var>parent</var> and | ||
| <a for=range>start offset</a> is greater than <var>index</var>, decrease its | ||
| <a for=range>start offset</a> by 1. | ||
|
|
@@ -5775,7 +5783,7 @@ are: | |
| <hr> | ||
|
|
||
| <p>The <dfn method for=Document><code>createRange()</code></dfn> method steps are to return a new | ||
| <a>live range</a> with (<a>this</a>, 0) as its <a for=range>start</a> an <a for=range>end</a>. | ||
| {{Range}} object with (<a>this</a>, 0) as its <a for=range>start</a> and <a for=range>end</a>. | ||
|
|
||
| <p class=note>The {{Range/Range()}} constructor can be used instead. | ||
|
|
||
|
|
@@ -8141,12 +8149,21 @@ interface Range : AbstractRange { | |
| }; | ||
| </pre> | ||
|
|
||
| <p>Objects implementing the {{Range}} interface are known as | ||
| <dfn export id=concept-live-range>live ranges</dfn>. | ||
| <p>A <dfn export id=concept-live-range>live range</dfn> is a <a>range</a> that is affected by | ||
| mutations to the <a>node tree</a>.</p> | ||
|
|
||
| <p>Objects implementing the {{Range}} interface are <a>live ranges</a>. | ||
|
|
||
| <p class=note>Algorithms that modify a <a>tree</a> (in particular the <a for=/>insert</a>, | ||
| <a for=/>remove</a>, <a>replace data</a>, and <a lt="split a Text node">split</a> algorithms) modify | ||
| <a>live ranges</a> associated with that <a>tree</a>. | ||
| <a>live ranges</a> associated with that <a>tree</a>.</p> | ||
|
|
||
| <p>A <dfn export id=concept-composed-selection-range>composed selection range</dfn> is a | ||
| <a>live range</a> that has an associated {{Range}} object, a | ||
| <dfn export id=concept-legacy-selection-range for="composed selection range">legacy selection range</dfn>.</p> | ||
|
||
|
|
||
| <p class=note>The <a for="composed selection range">legacy selection range</a> is used to maintain | ||
| backward compatibility with the {{Selection/getRangeAt()}} API.</p> | ||
|
|
||
| <p>The <dfn export id=concept-range-root for="live range">root</dfn> of a <a>live range</a> is the | ||
| <a for=tree>root</a> of its <a for=range>start node</a>. | ||
|
|
@@ -8216,7 +8233,7 @@ but not its <a for=range>end node</a>, or vice versa. | |
|
|
||
| <dl class=domintro> | ||
| <dt><code><var>range</var> = new <a constructor>Range()</a></code> | ||
| <dd>Returns a new <a>live range</a>. | ||
| <dd>Returns a new {{Range}} object. | ||
| </dl> | ||
|
|
||
| <p>The <dfn constructor for=Range lt="Range()"><code>new Range()</code></dfn> constructor steps are | ||
|
|
@@ -8265,6 +8282,12 @@ steps: | |
| <a>boundary point</a> | ||
| (<var>node</var>, <var>offset</var>). | ||
|
|
||
| <li>If <var>range</var> is the <a for="composed selection range">legacy selection range</a> of a | ||
dizhang168 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <a>composed selection range</a>, set <var>selection range</var> to that | ||
| <a>composed selection range</a>. | ||
|
|
||
| <li>Otherwise, set <var>selection range</var> to null. | ||
dizhang168 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <li> | ||
| <dl class=switch> | ||
| <dt>If these steps were invoked as "set the start" | ||
|
|
@@ -8273,29 +8296,55 @@ steps: | |
| <li>If <var>range</var>'s | ||
| <a for="live range">root</a> is not equal to | ||
| <var>node</var>'s <a for=tree>root</a>, | ||
| or if <var>bp</var> is | ||
| <a for="boundary point">after</a> the | ||
| <var>range</var>'s <a for=range>end</a>, set | ||
| <var>range</var>'s <a for=range>end</a> | ||
| set <var>range</var>'s <a for=range>end</a> | ||
| to <var>bp</var>. | ||
|
|
||
| <li>Otherwise, if <var>bp</var> is | ||
dizhang168 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <a for="boundary point">after</a> the | ||
| <var>range</var>'s <a for=range>end</a>, then: | ||
| <ol> | ||
| <li>Set <var>range</var>'s <a for=range>end</a> | ||
| to <var>bp</var>. | ||
|
|
||
| <li>If <var>selection range</var> is not null, | ||
| set <var>selection range</var>’s | ||
| <a for="range">end</a> to <var>bp</var>. | ||
dizhang168 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </ol> | ||
|
|
||
| <li>Set <var>range</var>'s | ||
| <a for=range>start</a> to <var>bp</var>. | ||
|
|
||
| <li>If <var>selection range</var> is not null, | ||
| set <var>selection range</var>’s | ||
| <a for="range">start</a> to <var>bp</var>. | ||
dizhang168 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </ol> | ||
| <dt>If these steps were invoked as "set the end" | ||
| <dd> | ||
| <ol> | ||
| <li>If <var>range</var>'s | ||
| <a for="live range">root</a> is not equal to | ||
| <var>node</var>'s <a for=tree>root</a>, | ||
| or if <var>bp</var> is | ||
| <a for="boundary point">before</a> the | ||
| <var>range</var>'s <a for=range>start</a>, set | ||
| <var>range</var>'s <a for=range>start</a> | ||
| set <var>range</var>'s <a for=range>start</a> | ||
| to <var>bp</var>. | ||
|
|
||
| <li>Otherwise, if <var>bp</var> is | ||
| <a for="boundary point">before</a> the | ||
| <var>range</var>'s <a for=range>start</a>, then: | ||
| <ol> | ||
| <li>Set <var>range</var>'s <a for=range>start</a> | ||
| to <var>bp</var>. | ||
|
|
||
| <li>If <var>selection range</var> is not null, | ||
| set <var>selection range</var>’s | ||
| <a for="range">start</a> to <var>bp</var>. | ||
| </ol> | ||
|
|
||
| <li>Set <var>range</var>'s | ||
| <a for=range>end</a> to <var>bp</var>. | ||
|
|
||
| <li>If <var>selection range</var> is not null, | ||
| set <var>selection range</var>’s | ||
| <a for="range">end</a> to <var>bp</var>. | ||
| </ol> | ||
| </dl> | ||
| </ol> | ||
|
|
@@ -8576,7 +8625,7 @@ method steps are: | |
| (<var>new node</var>, <var>new offset</var>). | ||
| </ol> | ||
|
|
||
| <p>To <dfn export id=concept-range-extract for="live range">extract</dfn> a <a>live range</a> | ||
| <p>To <dfn export id=concept-range-extract for="live range">extract</dfn> a {{Range}} object | ||
| <var>range</var>, run these steps: | ||
|
|
||
| <ol> | ||
|
|
@@ -8753,8 +8802,7 @@ method steps are: | |
| <li><a>Append</a> <var>clone</var> | ||
| to <var>fragment</var>. | ||
|
|
||
| <li>Let <var>subrange</var> be a new <a>live range</a> | ||
| whose <a for=range>start</a> is | ||
| <li>Let <var>subrange</var> be a new {{Range}} object whose <a for=range>start</a> is | ||
| (<var>original start node</var>, <var>original start offset</var>) and | ||
| whose <a for=range>end</a> is | ||
| (<var>first partially contained child</var>, <var>first partially contained child</var>'s | ||
|
|
@@ -8807,8 +8855,7 @@ method steps are: | |
| <li><a>Append</a> <var>clone</var> | ||
| to <var>fragment</var>. | ||
|
|
||
| <li>Let <var>subrange</var> be a new <a>live range</a> | ||
| whose <a for=range>start</a> is | ||
| <li>Let <var>subrange</var> be a new {{Range}} object whose <a for=range>start</a> is | ||
| (<var>last partially contained child</var>, 0) and whose | ||
| <a for=range>end</a> is | ||
| (<var>original end node</var>, <var>original end offset</var>). | ||
|
|
@@ -8832,7 +8879,7 @@ result of <a for="live range">extracting</a> <a>this</a>. | |
|
|
||
| <p>To | ||
| <dfn export id=concept-range-clone for="live range" lt="clone the contents|cloning the contents">clone the contents</dfn> | ||
| of a <a>live range</a> <var>range</var>, run these steps: | ||
| of a {{Range}} object <var>range</var>, run these steps: | ||
|
|
||
| <ol> | ||
| <li><p>Let <var>fragment</var> be a new {{DocumentFragment}} <a for=/>node</a> whose | ||
|
|
@@ -8960,7 +9007,7 @@ of a <a>live range</a> <var>range</var>, run these steps: | |
| <li><a>Append</a> <var>clone</var> | ||
| to <var>fragment</var>. | ||
|
|
||
| <li>Let <var>subrange</var> be a new <a>live range</a> | ||
| <li>Let <var>subrange</var> be a new {{Range}} object | ||
| whose <a for=range>start</a> is | ||
| (<var>original start node</var>, <var>original start offset</var>) and | ||
| whose <a for=range>end</a> is | ||
|
|
@@ -9018,7 +9065,7 @@ of a <a>live range</a> <var>range</var>, run these steps: | |
| <li><a>Append</a> <var>clone</var> | ||
| to <var>fragment</var>. | ||
|
|
||
| <li>Let <var>subrange</var> be a new <a>live range</a> | ||
| <li>Let <var>subrange</var> be a new {{Range}} object | ||
| whose <a for=range>start</a> is | ||
| (<var>last partially contained child</var>, 0) and whose | ||
| <a for=range>end</a> is | ||
|
|
@@ -9038,7 +9085,7 @@ of a <a>live range</a> <var>range</var>, run these steps: | |
| result of <a for="live range">cloning the contents</a> of <a>this</a>. | ||
|
|
||
| <p>To <dfn export id=concept-range-insert for="live range">insert</dfn> a <a for=/>node</a> | ||
| <var>node</var> into a <a>live range</a> <var>range</var>, run these steps: | ||
| <var>node</var> into a {{Range}} object <var>range</var>, run these steps: | ||
|
|
||
| <ol> | ||
| <li>If <var>range</var>'s <a for=range>start node</a> is a {{ProcessingInstruction}} or {{Comment}} | ||
|
|
@@ -9188,7 +9235,8 @@ check first thing, which matches everyone but Firefox. | |
| </ol> | ||
|
|
||
| <p>The <dfn method for=Range><code>cloneRange()</code></dfn> method steps are to return a new | ||
| <a>live range</a> with the same <a for=range>start</a> and <a for=range>end</a> as <a>this</a>. | ||
| {{Range}} object with the same <a for=range>start</a> and <a for=range>end</a> as | ||
| <a>this</a>. | ||
|
|
||
| <p>The <dfn method for=Range><code>detach()</code></dfn> method steps are to do nothing. | ||
| <span class=note>Its functionality (disabling a {{Range}} object) was removed, but the method itself | ||
|
|
@@ -10441,6 +10489,7 @@ David Håsäther, | |
| David Hyatt, | ||
| Deepak Sherveghar, | ||
| Dethe Elza, | ||
| Di Zhang, | ||
| Dimitri Glazkov, | ||
| Domenic Denicola, | ||
| Dominic Cooney, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.