<?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>26248</bug_id>
          
          <creation_ts>2014-07-01 15:01:23 +0000</creation_ts>
          <short_desc>Spec mismatch between createHTMLDocument and textContent</short_desc>
          <delta_ts>2014-07-02 09:19:15 +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>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kangil Han">kangil.han</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</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>108612</commentid>
    <comment_count>0</comment_count>
    <who name="Kangil Han">kangil.han</who>
    <bug_when>2014-07-01 15:01:23 +0000</bug_when>
    <thetext>DOMImplementation.createHTMLDocument(title)[1] describes like,
  &apos;Create a Text node, set its data to title (which could be the empty string), and append it to the title element created in the previous step.&apos;
While textContent attribute[2] says,
  &apos;If new value is not the empty string, set node to a new Text node whose data is new value.&apos;

So it is confusing how to handle empty title DOMString on implementation.

[1] http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
[2] http://dom.spec.whatwg.org/#dom-node-textcontent

test case: http://w3c-test.org/dom/nodes/DOMImplementation-createHTMLDocument.html
test name: DOMImplementation.createHTMLDocument</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108613</commentid>
    <comment_count>1</comment_count>
    <who name="Kangil Han">kangil.han</who>
    <bug_when>2014-07-01 15:03:53 +0000</bug_when>
    <thetext>For the information,(alphabetical order)
  chrome: fail
  ff: pass
  ie: fail</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108614</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2014-07-01 15:17:41 +0000</bug_when>
    <thetext>What is exactly confusing? 
textnode.data = &quot;&quot;; sets text node&apos;s content to &quot;&quot;.
element.textContent = &quot;&quot;; removes all the child nodes.
element.textContent = &quot;foo&quot;; removes all the child nodes and 
creates a text node with data &quot;foo&quot; and appends it to element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108618</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-01 15:50:14 +0000</bug_when>
    <thetext>Basically, createHTMLDocument(&quot;foo&quot;) does NOT set .textContent = &quot;foo&quot; on the &lt;title&gt; element.  It does something slightly different that guarantees there is a text node inside that &lt;title&gt;.

Looking at Chrome&apos;s code, it implements createHTMLDocument(&quot;foo&quot;) by doing:

  document.title = &quot;foo&quot;;

which is defined in the spec in terms of setting textContent on the &lt;title&gt; element, which in fact does not match what the DOM spec says to do for createHTMLDocument.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108624</commentid>
    <comment_count>4</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2014-07-01 19:25:50 +0000</bug_when>
    <thetext>(In reply to Kangil Han from comment #1)
&gt; For the information,(alphabetical order)
&gt;   chrome: fail
&gt;   ff: pass
&gt;   ie: fail

Servo: pass</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108627</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-07-01 19:45:32 +0000</bug_when>
    <thetext>The specification does not seem confusing, but I guess comment 0 is actually asking if we want to align the two cases. I have no opinion really.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108637</commentid>
    <comment_count>6</comment_count>
    <who name="Kangil Han">kangil.han</who>
    <bug_when>2014-07-02 09:19:15 +0000</bug_when>
    <thetext>Thanks for comments!
I am fixing chromium behavior as per comment 3 suggested by Boris.
https://codereview.chromium.org/366883003/</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>