Commits

Aryeh Gregor committed bd9c816

Special-case normalize() for range mutations

https://www.w3.org/Bugs/Public/show_bug.cgi?id=13843

  • Participants
  • Parent commits 980319e

Comments (0)

Files changed (3)

  <a href="#concept-node" title="concept-node">node</a>
  <a href="#concept-tree-descendant" title="concept-tree-descendant">descendant</a>.
 
+ <li><p>Let <var title="">length</var> be <var title="">node</var>'s
+ <code title="dom-CharacterData-length"><a href="#dom-characterdata-length">length</a></code> attribute value.
+
  <li><p>Let <var title="">data</var> be the concatenation of the
  <a href="#concept-cd-data" title="concept-CD-data">data</a> of <var title="">node</var>'s
  <a href="#contiguous-text-nodes">contiguous <code>Text</code> nodes</a> (excluding itself), in
  <a href="#concept-tree-order" title="concept-tree-order">tree order</a>.
 
  <li><p><a href="#concept-cd-replace" title="concept-CD-replace">Replace data</a> with node
- <var title="">node</var>, offset <var title="">node</var>'s
- <code title="dom-CharacterData-length"><a href="#dom-characterdata-length">length</a></code> attribute value,
+ <var title="">node</var>, offset <var title="">length</var>,
  count 0, and data <var title="">data</var>.
 
+ <li><p>Let <var title="">current node</var> be <var title="">node</var>'s
+ <a href="#concept-tree-next-sibling" title="concept-tree-next-sibling">next sibling</a>.
+
+ <li><p>While <var title="">current node</var> is a <code><a href="#text">Text</a></code> node:
+
+ <ol>
+  <li><p>For each <a href="#concept-range" title="concept-range">range</a> whose
+  <a href="#concept-range-start-node" title="concept-range-start-node">start node</a> is
+  <var title="">current node</var>, add <var title="">length</var> to its
+  <a href="#concept-range-start-offset" title="concept-range-start-offset">start offset</a> and set its
+  <a href="#concept-range-start-node" title="concept-range-start-node">start node</a> to
+  <var title="">node</var>.
+
+  <li><p>For each <a href="#concept-range" title="concept-range">range</a> whose
+  <a href="#concept-range-end-node" title="concept-range-end-node">end node</a> is
+  <var title="">current node</var>, add <var title="">length</var> to its
+  <a href="#concept-range-end-offset" title="concept-range-end-offset">end offset</a> and set its
+  <a href="#concept-range-end-node" title="concept-range-end-node">end node</a> to
+  <var title="">node</var>.
+
+  <li><p>Add <var title="">current node</var>'s
+  <code title="dom-CharacterData-length"><a href="#dom-characterdata-length">length</a></code> attribute value to
+  <var title="">length</var>.
+
+  <li><p>Set <var title="">current node</var> to its
+  <a href="#concept-tree-next-sibling" title="concept-tree-next-sibling">next sibling</a>.
+ </ol>
+
  <li><p><a href="#concept-node-remove" title="concept-node-remove">Remove</a>
  <var title="">node</var>'s
  <a href="#contiguous-text-nodes">contiguous <code>Text</code> nodes</a> (excluding itself), in

Overview.src.html

  <span title=concept-node>node</span>
  <span title=concept-tree-descendant>descendant</span>.
 
+ <li><p>Let <var title>length</var> be <var title>node</var>'s
+ <code title=dom-CharacterData-length>length</code> attribute value.
+
  <li><p>Let <var title>data</var> be the concatenation of the
  <span title=concept-CD-data>data</span> of <var title>node</var>'s
  <span>contiguous <code>Text</code> nodes</span> (excluding itself), in
  <span title=concept-tree-order>tree order</span>.
 
  <li><p><span title=concept-CD-replace>Replace data</span> with node
- <var title>node</var>, offset <var title>node</var>'s
- <code title=dom-CharacterData-length>length</code> attribute value,
+ <var title>node</var>, offset <var title>length</var>,
  count 0, and data <var title>data</var>.
 
+ <li><p>Let <var title>current node</var> be <var title>node</var>'s
+ <span title=concept-tree-next-sibling>next sibling</span>.
+
+ <li><p>While <var title>current node</var> is a <code>Text</code> node:
+
+ <ol>
+  <li><p>For each <span title=concept-range>range</span> whose
+  <span title=concept-range-start-node>start node</span> is
+  <var title>current node</var>, add <var title>length</var> to its
+  <span title=concept-range-start-offset>start offset</span> and set its
+  <span title=concept-range-start-node>start node</span> to
+  <var title>node</var>.
+
+  <li><p>For each <span title=concept-range>range</span> whose
+  <span title=concept-range-end-node>end node</span> is
+  <var title>current node</var>, add <var title>length</var> to its
+  <span title=concept-range-end-offset>end offset</span> and set its
+  <span title=concept-range-end-node>end node</span> to
+  <var title>node</var>.
+
+  <li><p>Add <var title>current node</var>'s
+  <code title=dom-CharacterData-length>length</code> attribute value to
+  <var title>length</var>.
+
+  <li><p>Set <var title>current node</var> to its
+  <span title=concept-tree-next-sibling>next sibling</span>.
+ </ol>
+
  <li><p><span title=concept-node-remove>Remove</span>
  <var title>node</var>'s
  <span>contiguous <code>Text</code> nodes</span> (excluding itself), in
  <a href="#concept-node" title="concept-node">node</a>
  <a href="#concept-tree-descendant" title="concept-tree-descendant">descendant</a>.
 
+ <li><p>Let <var title="">length</var> be <var title="">node</var>'s
+ <code title="dom-CharacterData-length"><a href="#dom-characterdata-length">length</a></code> attribute value.
+
  <li><p>Let <var title="">data</var> be the concatenation of the
  <a href="#concept-cd-data" title="concept-CD-data">data</a> of <var title="">node</var>'s
  <a href="#contiguous-text-nodes">contiguous <code>Text</code> nodes</a> (excluding itself), in
  <a href="#concept-tree-order" title="concept-tree-order">tree order</a>.
 
  <li><p><a href="#concept-cd-replace" title="concept-CD-replace">Replace data</a> with node
- <var title="">node</var>, offset <var title="">node</var>'s
- <code title="dom-CharacterData-length"><a href="#dom-characterdata-length">length</a></code> attribute value,
+ <var title="">node</var>, offset <var title="">length</var>,
  count 0, and data <var title="">data</var>.
 
+ <li><p>Let <var title="">current node</var> be <var title="">node</var>'s
+ <a href="#concept-tree-next-sibling" title="concept-tree-next-sibling">next sibling</a>.
+
+ <li><p>While <var title="">current node</var> is a <code><a href="#text">Text</a></code> node:
+
+ <ol>
+  <li><p>For each <a href="#concept-range" title="concept-range">range</a> whose
+  <a href="#concept-range-start-node" title="concept-range-start-node">start node</a> is
+  <var title="">current node</var>, add <var title="">length</var> to its
+  <a href="#concept-range-start-offset" title="concept-range-start-offset">start offset</a> and set its
+  <a href="#concept-range-start-node" title="concept-range-start-node">start node</a> to
+  <var title="">node</var>.
+
+  <li><p>For each <a href="#concept-range" title="concept-range">range</a> whose
+  <a href="#concept-range-end-node" title="concept-range-end-node">end node</a> is
+  <var title="">current node</var>, add <var title="">length</var> to its
+  <a href="#concept-range-end-offset" title="concept-range-end-offset">end offset</a> and set its
+  <a href="#concept-range-end-node" title="concept-range-end-node">end node</a> to
+  <var title="">node</var>.
+
+  <li><p>Add <var title="">current node</var>'s
+  <code title="dom-CharacterData-length"><a href="#dom-characterdata-length">length</a></code> attribute value to
+  <var title="">length</var>.
+
+  <li><p>Set <var title="">current node</var> to its
+  <a href="#concept-tree-next-sibling" title="concept-tree-next-sibling">next sibling</a>.
+ </ol>
+
  <li><p><a href="#concept-node-remove" title="concept-node-remove">Remove</a>
  <var title="">node</var>'s
  <a href="#contiguous-text-nodes">contiguous <code>Text</code> nodes</a> (excluding itself), in