This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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?
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.
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.
WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=109090