Skip to content
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

LibWeb: Fix some CSS nesting bugs #2240

Merged

Commits on Nov 8, 2024

  1. LibWeb: Add & when setting nested style rule's selector text

    When we first parse a nested CSSStyleRule's selectors, we treat them as
    relative selectors and then patch them up with an `&` as needed.
    However, we weren't doing this when assigning the `cssText` attribute.
    So, let's do that!
    
    This gives us a couple of subtest passes. :^)
    AtkinsSJ committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    fa49a2c View commit details
    Browse the repository at this point in the history
  2. LibWeb/CSS: Require that tag-name simple selectors go first

    This fixes 1 subtest.
    AtkinsSJ committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    daaa197 View commit details
    Browse the repository at this point in the history
  3. LibWeb/CSS: Make non-nested & selector have 0 specificity

    If a & simple selector is on a style rule with no parent style rule,
    then it behaves like :scope - but notably, :scope provides 1
    specificity in the class category, but & is supposed to provide 0.
    
    To solve this, we stop replacing it directly, and just handle the & like
    any other simple selector. We know that if the selector engine ever
    sees one, it's equivalent to :scope, because the nested ones will have
    been replaced with :is() before that point.
    
    This gets us one more subtest pass. :^)
    AtkinsSJ committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    efbf001 View commit details
    Browse the repository at this point in the history