<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>24677</bug_id>
          
          <creation_ts>2009-03-18 13:17:37 -0700</creation_ts>
          <short_desc>REGRESSION: Range#surroundContents is inserting empty text nodes into the document</short_desc>
          <delta_ts>2009-03-20 01:19:00 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>24122</dup_id>
          
          <bug_file_loc>http://www.nick-santos.com/tests/webkit_range_test.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Regression</keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nick Santos">nicksantos</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>eric</cc>
    
    <cc>jparent</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>114218</commentid>
    <comment_count>0</comment_count>
    <who name="Nick Santos">nicksantos</who>
    <bug_when>2009-03-18 13:17:37 -0700</bug_when>
    <thetext>Repro steps:
1) Create a range over the text &quot;---[ANCHOR]Text to &lt;br/&gt; split[FOCUS]---&quot;
2) Call range.surroundContents(someElement)

Results:
A 0-length text node is inserted after [FOCUS]
This is happening in 528 and 530 on Windows.

You can visit
http://www.nick-santos.com/tests/webkit_range_test.html
for a simple test case.

I don&apos;t make very good cookies, but Julie says that she will award a cookie to the person that fixes this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114219</commentid>
    <comment_count>1</comment_count>
    <who name="Julie Parent">jparent</who>
    <bug_when>2009-03-18 13:20:11 -0700</bug_when>
    <thetext>This is definitely a regression, the test passes fine in Chrome 1.0/WebKit 525.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114349</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-03-19 12:35:06 -0700</bug_when>
    <thetext>Confirmed as a regression.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114363</commentid>
    <comment_count>3</comment_count>
      <attachid>28760</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-03-19 13:13:32 -0700</bug_when>
    <thetext>Created attachment 28760
further reduced test case

This version works in Firefox, too. The problem is actually in Range.insertNode, which surroundContents uses internally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114365</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-03-19 13:23:57 -0700</bug_when>
    <thetext>Err, not quite - it&apos;s the range start that&apos;s different after extractContents(). It used to be ([object HTMLDivElement], 1), but now it&apos;s ([object Text], 3), so insertNode is arguably correct to split the node.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114401</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-03-19 16:24:39 -0700</bug_when>
    <thetext>I&apos;ve got a patch that fixes this and bug 24122, which was filed earlier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114455</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-03-20 01:18:41 -0700</bug_when>
    <thetext>Oops, I meant to resolve as duplicate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114456</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-03-20 01:19:00 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 24122 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>28760</attachid>
            <date>2009-03-19 13:13:32 -0700</date>
            <delta_ts>2009-03-19 13:13:32 -0700</delta_ts>
            <desc>further reduced test case</desc>
            <filename>webkit_range_test.html</filename>
            <type>text/html</type>
            <size>737</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGh0bWw+CiAgPGhlYWQ+CiAgICA8c2NyaXB0PgoKICAgICAgZnVuY3Rpb24gZG9JdCgpIHsKICAg
ICAgICB2YXIgeCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCd4Jyk7CiAgICAgICAgdmFyIHJh
bmdlID0gZG9jdW1lbnQuY3JlYXRlUmFuZ2UoKTsKICAgICAgICByYW5nZS5zZXRTdGFydCh4LmZp
cnN0Q2hpbGQsIDMpOwogICAgICAgIHJhbmdlLnNldEVuZCh4Lmxhc3RDaGlsZCwgMTgpOwovLyAg
ICAgICAgcmFuZ2Uuc3Vycm91bmRDb250ZW50cyhkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdiJykp
OwogICAgICAgIHJhbmdlLmV4dHJhY3RDb250ZW50cygpOwogICAgICAgIHJhbmdlLmluc2VydE5v
ZGUoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiYiIpKQogICAgICAgIGRvY3VtZW50LmdldEVsZW1l
bnRCeUlkKCdhY3R1YWwnKS5pbm5lckhUTUwgPSAneCBoYXMgJyArIHguY2hpbGROb2Rlcy5sZW5n
dGggKyAnIGNoaWxkcmVuJzsKICAgICAgfQogICAgPC9zY3JpcHQ+CiAgPC9oZWFkPgogIDxib2R5
IG9ubG9hZD0iZG9JdCgpIj4KICAgIDxkaXYgaWQ9J3gnPi0tLVRleHQgdGhhdCA8YnIvPndpbGwg
YmUgc3Vycm91bmRlZC0tLTwvZGl2PgogICAgPGRpdj5FeHBlY3RlZCBvdXRwdXQ6PC9kaXY+PGRp
diBpZD0nZXhwZWN0ZWQnPnggaGFzIDMgY2hpbGRyZW48L2Rpdj4KICAgIDxkaXY+QWN0dWFsIG91
dHB1dDo8L2Rpdj48ZGl2IGlkPSdhY3R1YWwnPjwvZGl2PgogIDwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>