<?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>24017</bug_id>
          
          <creation_ts>2013-12-06 06:02:41 +0000</creation_ts>
          <short_desc>template is not in ancestor chain for template contents in &quot;Parsing HTML fragments&quot; algorithm</short_desc>
          <delta_ts>2013-12-10 22:50:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</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>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="William Chen">wchen</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>rafaelw</cc>
    
    <cc>rniwa</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97230</commentid>
    <comment_count>0</comment_count>
    <who name="William Chen">wchen</who>
    <bug_when>2013-12-06 06:02:41 +0000</bug_when>
    <thetext>http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#parsing-html-fragments

In the &quot;Parsing HTML fragments&quot; step 4, sub-step 7, it says:

&quot;[...] (If there is no such form element, or if there&apos;s a template element in the ancestor chain, the form element pointer keeps its initial value, null.)&quot;

It looks like the intent is to make sure that the form pointer is null for descendents of template contents. However, the ancestor chain of those descendents will not contain the hosting template element. It will contain the the template content document fragment (at the root).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97258</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-06 18:28:07 +0000</bug_when>
    <thetext>Hm. I guess there&apos;s no way to know from just looking at a node whether or not the node is template contents, huh. I wonder how to fix this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97262</commentid>
    <comment_count>2</comment_count>
    <who name="William Chen">wchen</who>
    <bug_when>2013-12-06 18:35:33 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #1)
&gt; Hm. I guess there&apos;s no way to know from just looking at a node whether or
&gt; not the node is template contents, huh. I wonder how to fix this.

You can get to the template content document fragment by walking up to the root and you can check the host (http://dom.spec.whatwg.org/#concept-documentfragment-host) to see if it is a template element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97263</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-06 18:46:55 +0000</bug_when>
    <thetext>Ah, interesting. Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97354</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-09 21:17:28 +0000</bug_when>
    <thetext>On further reflection, I removed the special-casing of &lt;template&gt; there. It doesn&apos;t make any sense if you think about it, because if the innerHTML contents _do_ include a &lt;form&gt;, the form element pointer gets set and everything — the parser logic doesn&apos;t know it&apos;s in a template there.

This does mean we&apos;re in a weird spot here, where this:

   &lt;form&gt;&lt;template&gt;&lt;form&gt;&lt;form&gt;

...parses differently than the similar case where a &lt;template&gt; element&apos;s contents are set to &quot;&lt;form&gt;&lt;form&gt;&quot; using innerHTML.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97427</commentid>
    <comment_count>5</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-12-10 22:50:06 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8337.
Check-in comment: innerHTML on template contents works like outside templates, when it comes to forms.
http://html5.org/tools/web-apps-tracker?from=8336&amp;to=8337</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>