[Webkit-unassigned] [Bug 16765] New: Range does not correctly stringify with toString (Acid3)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jan 6 17:49:53 PST 2008


http://bugs.webkit.org/show_bug.cgi?id=16765

           Summary: Range does not correctly stringify with toString (Acid3)
           Product: WebKit
           Version: 525+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: proton at wiretapped.net


Acid3 test 15 failure:
Test 15: FAIL (range didn't start with the expected text; range stringified to
'')

      // test 15: Ranges under mutations: insertion into text nodes
      var doc = getTestDocument();
      var p = doc.createElement('p');
      var t1 = doc.createTextNode('12345');
      p.appendChild(t1);
      var t2 = doc.createTextNode('ABCDE');
      p.appendChild(t2);
      doc.body.appendChild(p);
      var r = doc.createRange();
      r.setStart(p.firstChild, 2);
      r.setEnd(p.firstChild, 3);
      assert(!r.collapsed, "collapsed is wrong at start");
      assertEquals(r.commonAncestorContainer, p.firstChild,
"commonAncestorContainer is wrong at start");
      assertEquals(r.startContainer, p.firstChild, "startContainer is wrong at
start");
      assertEquals(r.startOffset, 2, "startOffset is wrong at start");
      assertEquals(r.endContainer, p.firstChild, "endContainer is wrong at
start");
      assertEquals(r.endOffset, 3, "endOffset is wrong at start");
      assertEquals(r.toString(), "3", "range in text node stringification
failed");
      r.insertNode(p.lastChild);
      assertEquals(p.childNodes.length, 3, "insertion of node made wrong number
of child nodes");
      assertEquals(p.childNodes[0], t1, "unexpected first text node");
      assertEquals(p.childNodes[0].data, "12", "unexpected first text node
contents");
      assertEquals(p.childNodes[1], t2, "unexpected second text node");
      assertEquals(p.childNodes[1].data, "ABCDE", "unexpected second text
node");
      assertEquals(p.childNodes[2].data, "345", "unexpected third text node
contents");
      // The spec is very vague about what exactly should be in the range
afterwards:
      // the insertion results in a splitText(), which it says is equivalent to
a truncation
      // followed by an insertion, but it doesn't say what to do when you have
a truncation,
      // so we don't know where either the start or the end boundary points end
up.
      // The spec really should be clarified for how to handle splitText() and
      // text node truncation in general
      // The only thing that seems very clear is that the inserted text node
should
      // be in the range, and it has to be at the start, since insertion always
puts it at
      // the start.
      assert(!r.collapsed, "collapsed is wrong after insertion");
      //assertEquals(r.commonAncestorContainer, p, "commonAncestorContainer is
wrong after insertion");
      //assertEquals(r.startContainer, p, "startContainer is wrong after
insertion");
      //assertEquals(r.startOffset, 1, "startOffset is wrong after insertion");
      //assertEquals(r.endContainer, p.lastChild, "endContainer is wrong after
insertion");
      //assertEquals(r.endOffset, 1, "endOffset is wrong after insertion");
      assert(r.toString().match(/^ABCDE/), "range didn't start with the
expected text; range stringified to '" + r.toString() + "'");
      return 1;


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list