This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20849 - [Templates]: Should non-template end tags be ignored in template contents insertion mode?
Summary: [Templates]: Should non-template end tags be ignored in template contents ins...
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 15476
  Show dependency treegraph
 
Reported: 2013-02-01 21:05 UTC by Rafael Weinstein
Modified: 2013-02-06 21:49 UTC (History)
4 users (show)

See Also:


Attachments

Description Rafael Weinstein 2013-02-01 21:05:28 UTC
Right now, it just switches to in body, but doesn't choose a context by setting the mode into the stack of template insertion modes.

e.g.

<template></div><div><template></template><tr>

will produce

| <html>
|   <head>
|     <template>
|       #document-fragment
|         <div>
|         <template>
|           #document-fragment
|         <tr>

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

It seems like there are three choices here:

1) Leave this as is -- it's probably not hurting anything, and it'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:

| <html>
|   <head>
|     <template>
|       #document-fragment
|         <div>
|         <template>
|           #document-fragment

(ignoring the <tr> because the initial </div> will have set the context as <body>

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

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