contao icon indicating copy to clipboard operation
contao copied to clipboard

Fix html attributes style parsing for edge cases

Open ausi opened this issue 1 year ago • 2 comments

Some edge cases were not yet supported for style="" in our HtmlAttributes class, especially the use of /* comments.

This PR changes the style parser implementation a little bit. It now keeps the style rules exactly as written without removing ~~whitespaces (see diff of the test cases) or~~ other things. But it now also handles upper and lower case correctly as it sees color and COLOR as the same while differing between --foo and --FOO. I think this should be more stable and better fits the mental modal of the HtmlAttributes.

ausi avatar Mar 21 '24 22:03 ausi

It now also recognizes that COLOR, c\6F lor, c\olor, /* Farbe: */ color and color are all the same property.

ausi avatar Mar 22 '24 17:03 ausi

I now brought whitespace normalization back with the style color: red; background: blue; to be compliant with the CSSOM standard: https://www.w3.org/TR/cssom-1/#serialize-a-css-declaration

ausi avatar Mar 24 '24 20:03 ausi

Thank you @ausi.

leofeyer avatar Apr 09 '24 08:04 leofeyer