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

[whatwg] script tag handling in "after head"

From: Tommy Thorsen <tommy@kvaleberg.com>
Date: Tue, 11 Nov 2008 12:27:04 +0100
Message-ID: <49196C08.8020307@kvaleberg.com>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:07 UTC