[CSS 2.1] Request for links to additional error recovery parser tests

I've done some basic homework and pulled up a few of the public suites for error recovery but nothing shows up as really complex. I'm specifically trying to find test cases for matching pairs of braces/blocks/parens.

style="color: red }; background-color: green;"

Opera/Safari treat the } as the end of the style block. Perhaps by implying a { at the beginning, but they don't parse after the } at all.
FireFox will throw out the color: red and apply the background-color: green as if it realizes color as an invalid property.
IE 7 and less will apply both properties.

That's actually not an interesting nesting/pairing problem except for the idea that maybe some implementations are implying an open LPAREN and ending the parsing as soon as they see something invalid without much error recovery at all. I would expect to be able to recover in the inline style block just the same as I might be able to recover in a block that is part of a full ruleset.

The interesting nesting/pairing problem then becomes, is the nesting/pairing count a true stack or not? In other words:

[({])}... Note the out of order pairings... If we assume a true stack then the ] will close the entire block since we'll scan the stack for a matching item and assume the user left out two tokens. The following ) and } just become invalid tokens and get thrown out. Or we could say that the ] and ) are invalid tokens and then close the top item off the stack when we see }. Another option is to keep and independent count all 3 of which wind up being 0 after the last term.

I think making sure that the current nesting token matches the top of the stack is correct and the other tokens are thrown out meaning we don't actually close the scope and therefore we can't recover in this case. All browser but IE end up with something here.

DIV
{
                color: red;
                color: [ ( {
                ] ) }
                ;

                color: green;
}

Fixing this would imply the following test case which FireFox/Opera pass, Safari (3.0 for Windows)/IE fails.

DIV
{
    color: red;
    color: [ ( {
    ] ) } ) ]
    ;

    color: green;
}

This gets worse if you mix the declaration and ruleset recovery together. The following should technically close the first ruleset and the next one should probably be valid... However, mixed bag of responses on this one from all browsers.

DIV
{
    color: red;
    color: [ ( {
    ] ) } ) ]
}

DIV
{
    color: green;
}

You can trigger additional odd behavior by supplementing the } that closes the first DIV block with more }'s and see that it can further change behavior. One extra and Opera (9.50 beta) was going red. Apparently count(}) mod 2 swaps the behavior back and forth.

DIV
{
    color: red;
    color: [ ( {
    ] ) } ) ]
}

}

DIV
{
    color: green;
}

Justin Rogers [MSFT]

Received on Friday, 21 December 2007 00:17:39 UTC