[whatwg] script tag handling in "after head"
Ian Hickson
ian at hixie.ch
Mon Dec 1 19:58:48 PST 2008
On Tue, 11 Nov 2008, Tommy Thorsen wrote:
>
> 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...
That seems reasonable. Another approach would be to pop the head element
pointer after the end tag in the "in CDATA/RCDATA" insertion mode. I've
gone with your approach.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list