[whatwg] script tag handling in "after head"

This one is kinda complex, but I'll try to explain the problem. The 
algorithm for handling script start tags in the "after head" insertion 
mode requires us to push the head element pointer onto the stack of open 
elements, then process the token using the rules for the "in head" 
insertion mode. Finally we are required to:

    Pop the current node (which will be the node pointed to by the head 
element pointer)

The assertion that the current node is still the head element pointer 
does not seem correct, as we push a script element onto the stack of 
open elements in the "A start tag whose tag name is 'script'" section of 
the "in head" insertion mode.

Alternatively, the script tag handling in "in head" could be interpreted 
to not require us to push the script element onto the stack of open 
elements, but then the following assertion in "An end tag whose tag name 
is 'script'" in "in CDATA/RCDATA" will not hold true:

    Let script be the current node  (which will be a script element).

In our implementation, I've chosen to implement the "A start tag token 
whose tag name is one of: 'base', 'link', 'meta', 'noframes', 'script', 
'style', 'title'" as if it said:

    Parse error.
    Let /node/ be the head element pointer
    Push the node pointed to by the head element pointer onto the stack 
of open elements.
    Process the token using the rules for the "in head" insertion mode.
    Remove /node/ from the stack of open elements

I haven't come across any problems with this approach so far...


regards,
Tommy

Received on Tuesday, 11 November 2008 03:27:04 UTC