<?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>20849</bug_id>
          
          <creation_ts>2013-02-01 21:05:28 +0000</creation_ts>
          <short_desc>[Templates]: Should non-template end tags be ignored in template contents insertion mode?</short_desc>
          <delta_ts>2013-02-06 21:49:43 +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>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</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>---</target_milestone>
          
          <blocked>15476</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Rafael Weinstein">rafaelw</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>adamk</cc>
    
    <cc>hsivonen</cc>
    
    <cc>tross</cc>
    
    <cc>wchen</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>82485</commentid>
    <comment_count>0</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-02-01 21:05:28 +0000</bug_when>
    <thetext>Right now, it just switches to in body, but doesn&apos;t choose a context by setting the mode into the stack of template insertion modes.

e.g.

&lt;template&gt;&lt;/div&gt;&lt;div&gt;&lt;template&gt;&lt;/template&gt;&lt;tr&gt;

will produce

| &lt;html&gt;
|   &lt;head&gt;
|     &lt;template&gt;
|       #document-fragment
|         &lt;div&gt;
|         &lt;template&gt;
|           #document-fragment
|         &lt;tr&gt;

I.e the fact that the leading &lt;/div&gt; was processed allowed the following div to be processed without choosing a implied context, which happened later when the &lt;tr&gt; was encountered.

It seems like there are three choices here:

1) Leave this as is -- it&apos;s probably not hurting anything, and it&apos;s not like the parser is perfect at handling poorly formed content

2) Choose the implied context based on both start and end tags (e.g. the input above would produce:

| &lt;html&gt;
|   &lt;head&gt;
|     &lt;template&gt;
|       #document-fragment
|         &lt;div&gt;
|         &lt;template&gt;
|           #document-fragment

(ignoring the &lt;tr&gt; because the initial &lt;/div&gt; will have set the context as &lt;body&gt;

3) Simply ignore end tag tokens that aren&apos;t &lt;/template&gt; while in template contents mode. This would produce the same output as (2), but is more &quot;correct&quot; in that it uses the first significant start tag as the determinant of the implied context.

Thoughts?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82487</commentid>
    <comment_count>1</comment_count>
    <who name="William Chen">wchen</who>
    <bug_when>2013-02-01 21:30:19 +0000</bug_when>
    <thetext>I would lean towards (3). The output of (1) doesn&apos;t look like it would be very useful as a template because it&apos;s not valid in the context of either a body or table.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82645</commentid>
    <comment_count>2</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-02-06 21:41:12 +0000</bug_when>
    <thetext>Ok. Any end tag other than &lt;/template&gt; is now a parse error and ignored. Also, DOCTYPE is likewise ignored. Note that the &quot;Anything else&quot; clause is now gone since all tokens are covered by the steps for &quot;template contents&quot; mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82649</commentid>
    <comment_count>3</comment_count>
    <who name="Rafael Weinstein">rafaelw</who>
    <bug_when>2013-02-06 21:49:43 +0000</bug_when>
    <thetext>WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=109090</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>