W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2008

[whatwg] script tag handling in "after head"

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 2 Dec 2008 03:58:48 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0812020355360.17414@hixie.dreamhostps.com>
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.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 1 December 2008 19:58:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:48 GMT