W3C home > Mailing lists > Public > public-html@w3.org > July 2007

Re: Scope, implied end tags, another scope check (detailed review of parsing algorithm)

From: Henri Sivonen <hsivonen@iki.fi>
Date: Thu, 5 Jul 2007 11:12:56 +0300
Message-Id: <6042E48D-3AF7-46F6-9D15-17DBE21E261F@iki.fi>
Cc: "public-html@w3.org WG" <public-html@w3.org>
To: Ian Hickson <ian@hixie.ch>

On Jul 5, 2007, at 10:52, Ian Hickson wrote:

> On Thu, 5 Jul 2007, Henri Sivonen wrote:
>>
>> For some elements the spec says:
>>> If the stack of open elements has an element in scope with the  
>>> same tag name
>>> as that of the token, then generate implied end tags.
>>>
>>> Now, if the current node is not an element with the same tag name  
>>> as that of
>>> the token, then this is a parse error.
>>>
>>> If the stack of open elements has an element in scope with the  
>>> same tag name
>>> as that of the token, then pop elements from this stack until an  
>>> element
>>> with that tag name has been popped from the stack.
>>
>> I can't figure out you one might get the stack in such a state  
>> that the
>> "generate implied end tags" step changed the situation so that the
>> second "If the stack of open elements has an element in scope"  
>> found a
>> different node than the first "If the stack of open elements has an
>> element in scope".
>>
>> Am I right? If yes, it would make sense to write this is a way that
>> doesn't suggest that implementors search the stack twice.
>
> Do you have any proposals for how to phrase it?

Let /node/ be the last element in scope with the same tag name as  
that of the token or null if there isn't such element in scope.

If /node/ is not null, generate implied end tags.

Now, if the current node is not an element with the same tag name as  
that of the token, then this is a parse error.

If /node/ is not null, then pop elements from the stack up to and  
including /node/.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/
Received on Thursday, 5 July 2007 08:13:09 GMT

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