elinks icon indicating copy to clipboard operation
elinks copied to clipboard

[css] duplicate rules should override previously defined rules

Open hedyhli opened this issue 1 year ago • 2 comments

While working on #300 I encountered what is likely to be a bug.

Minimal reproducible example:

<html>
  <head>
    <style>
    body {color: yellow;}
    body {color: blue;}
    </style>
  </head>
  <body>
  <p>text</p>
  </body>
</html>
elinks test.html

The text should show up in blue out of all other browsers I've tested, but it shows up in yellow instead.

I haven't digged into how this happens or whether it can be fixed, but I saw this comment in css_parse_ruleset:

https://github.com/rkd77/elinks/blob/e136d663c94ed73fe5b0c885a76aeec34996ae13/src/document/css/parser.c#L591-L601

It gives me reason to believe that repeated rules should already be overriding previous rules... but it isn't.

hedyhli avatar Apr 20 '24 06:04 hedyhli

When libcss is enabled it is blue.

rkd77 avatar Apr 20 '24 07:04 rkd77

Please check this ^ commit.

rkd77 avatar Apr 20 '24 18:04 rkd77