rust-cssparser icon indicating copy to clipboard operation
rust-cssparser copied to clipboard

BadString recovery issues

Open xmo-odoo opened this issue 1 year ago • 0 comments

According to CSS forward-compatible parsing rules, if a CSS declaration fails to parse the parser should forward until whichever is closer of EOF and a semicolon then resume parsing.

cssparser doesn't seem to allow for this when trying to parse a "bad string" containing a newline e.g.

text-decoration: '\n'; color: green

Once the parser has triggered a BadString error, the next token is

    QuotedString(
        "; color: green",
    ),

This is not the behaviour of browsers e.g. if this is added as a style value to an element in firefox, the text-decoration is flagged as an invalid property value, and the color declaration is parsed properly and applied.

xmo-odoo avatar Oct 28 '24 13:10 xmo-odoo