W3C home > Mailing lists > Public > public-html@w3.org > February 2008

Tree construction: Ambiguity in "process the token as if the insertion mode was ..."

From: Philip Taylor <pjt47@cam.ac.uk>
Date: Fri, 15 Feb 2008 16:11:33 +0000
Message-ID: <47B5B9B5.8040904@cam.ac.uk>
To: HTML WG <public-html@w3.org>

Consider a document like <table><tr><table>

After the first two tokens, we have:

Mode: in row
Current node: <tr>

then

Token: <table>
"in row" "Anything else" -> "Process the token as if the insertion mode 
was "in table""
New mode, for the duration of the reprocessing step: in table

     Token: <table>
     "in table" "A start tag whose tag name is "table"" -> "Act as if an 
end tag token with the tag name "table" had been seen"

     Token: </table>
     "in table" "An end tag whose tag name is "table"" -> "Generate 
implied end tags"
       -> current node is <tr>, so act as if </tr> and then generate 
implied end tags again

         Token: </tr>
         "in table" "An end tag whose tag name is one of: ..."tr"" -> 
"Ignore the token"

         Infinite loop when generating implied end tags again.

which is clearly not good. It seems my problem is in interpreting 
"Process the token as if the insertion mode was "in table"" as meaning 
it should effectively set the insertion mode to "in table" and then 
process the token (hence affecting any other generated/reprocessed 
tokens within that reprocessing step), when actually it should only 
affect the single next operation and not anything more deeply nested.


I'd suggest adding a paragraph like:

"When the steps below require the UA to process a token as if the 
insertion mode was 'mode', this must apply only to the single next token 
processing operation. If the processing of that token causes it to be 
reprocessed, or causes a new token to be processed, then it will be 
processed in the standard insertion mode and not necessarily in 'mode'."

and then linking to it in relevant places, like "process the token <a 
href='#asif'>as if the insertion mode was</a> ..."

-- 
Philip Taylor
pjt47@cam.ac.uk
Received on Friday, 15 February 2008 16:11:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:12 GMT