Skip to content

Overriding inheritance not working? #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
pnodder opened this issue May 21, 2025 · 0 comments
Open
5 tasks done

Overriding inheritance not working? #184

pnodder opened this issue May 21, 2025 · 0 comments
Labels

Comments

@pnodder
Copy link

pnodder commented May 21, 2025

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp.Css?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Xml for Xml support)
  • Did you perform a search in the issues?

Description

Overriding inheritance does not seem to work as expected. Same behaviour regardless of using the shorthand property or the individual properties.

Using Anglesharp.CSS 1.0.0-beta.151.

Steps to Reproduce

var text = """
           <html lang="en">
           <head>
               <style>
                   table {
                       border: medium solid;
                   }
                   table * {
                       border: inherit;
                   }
               </style>
               <title></title>
           </head>
           <body>
               <table>
                   <tbody>
                     <tr><td>hello1</td></tr>
                     <tr><td>hello2</td></tr>
                     <tr><td>hello3</td></tr>
                   </tbody>
               </table>
           </body>
           </html>
           """;

var ctx = BrowsingContext.New(Configuration.Default.WithDefaultLoader().WithCss());
var p = new HtmlParser(new HtmlParserOptions(), ctx);
var doc = await p.ParseDocumentAsync(text);

var td = doc.QuerySelector("body>table>tbody>tr:nth-child(1)>td");
var style = td.ComputeCurrentStyle();

Expected Behavior

The td style should contain the same border attribute values as the parent table.

Actual Behavior

The td style border attribute values are all initial.

Possible Solution / Known Workarounds

No response

@pnodder pnodder added the bug label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant