[Bug 19946] New: Range fixup for normalize() needs to account for boundary points in removed nodes' parents

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

          Priority: P2
            Bug ID: 19946
                CC: matspal@gmail.com, mike@w3.org, www-dom@w3.org
          Assignee: annevk@annevk.nl
           Summary: Range fixup for normalize() needs to account for
                    boundary points in removed nodes' parents
        QA Contact: public-webapps-bugzilla@w3.org
          Severity: minor
    Classification: Unclassified
                OS: All
          Reporter: ayg@aryeh.name
          Hardware: All
            Status: NEW
           Version: unspecified
         Component: DOM
           Product: WebAppsWG

Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=804784

Test-case:

data:text/html,<!doctype html>
abcdef
<script>
document.body.firstChild.splitText(3);
var range = document.createRange();
range.setStart(document.body, 1);
document.normalize();
document.body.textContent = range.startContainer
+ " " + range.startOffset;
</script>

Expected is "[object Text] 3".  WebKit gets it right.  Gecko/Opera say "[object
HTMLBodyElement] 1", and IE says "[object HTMLBodyElement] 0" (?!).  The spec
current requires Gecko/Opera behavior, but that's a bug.  Gecko is changing to
WebKit's behavior.  In the while loop in the algorithm, the range fixup is only

"""
For each range whose start node is current node, add length to its start offset
and set its start node to node.

For each range whose end node is current node, add length to its end offset and
set its end node to node.
"""
http://dom.spec.whatwg.org/#dom-node-normalize

If we're already going to fix up ranges, we may as well do it right -- we
should also change boundary points at (current node's parent, current node's
index) to (node, length).  Otherwise we fix only points in the actual text
node, not in in its parent adjacent to it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Monday, 12 November 2012 12:00:48 UTC