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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>12389</bug_id>
          
          <creation_ts>2011-03-28 17:41:35 +0000</creation_ts>
          <short_desc>replaceWholeText should not remove the context node, just change its data</short_desc>
          <delta_ts>2011-09-07 13:06:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Aryeh Gregor">ayg</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>47008</commentid>
    <comment_count>0</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-03-28 17:41:35 +0000</bug_when>
    <thetext>The current spec says

&quot;&quot;&quot;
The replaceWholeText(data) method must run these steps:

  1. Remove the contiguous Text nodes of the context object.

  2. If data is not the empty string, insert a new Text node whose data is data at the place of the removed nodes, return the new Text node, and then terminate these steps.

  3. Return null.
&quot;&quot;&quot;

But in fact browsers don&apos;t remove the node itself, they only remove siblings.  Test case:

data:text/html,&lt;!doctype html&gt;
&lt;p&gt;Abc&lt;/p&gt;
&lt;script&gt;
var original = document.querySelector(&quot;p&quot;).firstChild;
document.body.textContent = original.replaceWholeText(&quot;Def&quot;) == original;
&lt;/script&gt;

Results in &quot;true&quot; in Firefox 4.0, Chrome 11 dev, and Opera 11.  (I didn&apos;t have IE available for easy testing.)  The spec should say that if data is not the empty string, the contiguous Text nodes of the context objects must be removed except for the context object itself, then the context object&apos;s data should be set and the method should return the context object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56463</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2011-09-07 13:06:58 +0000</bug_when>
    <thetext>https://bitbucket.org/ms2ger/dom-core/changeset/50af8e2bac3e

Though note bug 13046.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>