<?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>17216</bug_id>
          
          <creation_ts>2012-05-28 07:48:26 +0000</creation_ts>
          <short_desc>Fragment serialization doesn&apos;t handle the case when &apos;the node&apos; is a void element yet has child nodes</short_desc>
          <delta_ts>2012-05-28 09:05:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</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="Olli Pettay">bugs</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ayg</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68192</commentid>
    <comment_count>0</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-05-28 07:48:26 +0000</bug_when>
    <thetext>If someone does &lt;input&gt;.appendChild(document.createElement(&quot;div&quot;));
per http://html5.org/specs/dom-parsing.html#innerhtml and 
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm
&lt;input&gt;.innerHTML would become &quot;&lt;div&gt;&lt;/div&gt;&quot;.
That doesn&apos;t look right, given that if &lt;input&gt; element is handled as a 
child of some element which is being serialized, the div element wouldn&apos;t
end up to the innerHTML serialization.

So, I believe http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm should
handle the case when &apos;the node&apos; is a void element and return empty string
in such case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68193</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2012-05-28 08:03:39 +0000</bug_when>
    <thetext>Why? You can still set &lt;input&gt;.innerHTML = &apos;&lt;div&gt;&lt;/div&gt;&apos;.

Since void elements can have children in XML or with DOM API, I don&apos;t see the point in changing this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68194</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-05-28 08:11:54 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Why? You can still set &lt;input&gt;.innerHTML = &apos;&lt;div&gt;&lt;/div&gt;&apos;.

You can, but why is it expected that that actually parses something?

&gt; 
&gt; Since void elements can have children in XML or with DOM API, I don&apos;t see the
&gt; point in changing this.
It is strange inconsistency in the innerHTML serialization that it depends
on the context where you use innerHTML what gets serialized.
I mean, in some cases the contents of a void element is serialized, but in some
cases it isn&apos;t.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68196</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2012-05-28 08:26:10 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; You can, but why is it expected that that actually parses something?

Because it&apos;s what most browsers did when this was specified, I think.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68200</commentid>
    <comment_count>4</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-05-28 09:01:38 +0000</bug_when>
    <thetext>Ok, Ms2ger gave yet another bad case.
Ms2ger:	&lt;img&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/img&gt;, what&apos;s div.innerHTML?

So, ok, serialization is broken by design.
I don&apos;t care enough, and I can close this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68201</commentid>
    <comment_count>5</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-05-28 09:05:40 +0000</bug_when>
    <thetext>FWIW, from Live DOM Viewer:

&lt;!DOCTYPE html&gt;
&lt;img&gt;
&lt;script&gt;
document.body.firstChild.appendChild(document.createElement(&quot;div&quot;));
w(document.body.firstChild.innerHTML);
&lt;/script&gt;

This outputs the empty string in Chrome 21 dev and Opera Next 12.00 alpha, and &quot;&lt;div&gt;&lt;/div&gt;&quot; in IE10(ish) and Firefox 15.0a1.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>