Re: In body other end tag handling convoluted to get at most one error

On May 24, 2008, at 12:03, Ian Hickson wrote:

> On Fri, 4 Apr 2008, Henri Sivonen wrote:
>>>
>>> An end tag token not covered by the previous entries [...]
>>
>> I think the above formulation is confusing, because it runs through
>> complicated steps in the simple case: when the node on the stack  
>> indeed
>> matches the token.
>
> When the token matches the current node, the steps are:
[...]
> I guess that's mildly more complicated than necessary, but it's hardly
> "complicated steps". Still, UAs can trivially optimise it by adding:
>
>   If current node == token:
>      Pop node. Abort.
>
> ...to the top of the algorithm, without affecting black box  
> conformance in
> any way.

Done.

>> It seems to me that the whole purpose of the complication (searching
>> stack first and then batch-popping instead of popping as the search
>> proceeds) is to give on error about premature end tag instead of  
>> giving
>> many error one per each unclosed element.
>
> Partially, but it's also to avoid the bug your code has:
[...]
> What does your code do with this?:
>
>   <div><p>Hello</x> World

Fixed on trunk and test case added to html5lib repo.

Thanks.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Tuesday, 24 June 2008 11:21:46 UTC