Skip to content

Add section about never matching sibling selectors after :scope #42364

@nchevobbe

Description

@nchevobbe

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:scope

What specific section or headline is this issue about?

none, this probably would be in a new section

What information was incorrect, unhelpful, or incomplete?

No warnings about using sibling selectors after :scope

What did you expect to see?

If you write a selector like :scope ~ *, the rule will never match
In Firefox, such selectors generate a warning (that will be exposed in the Inspector) :
https://searchfox.org/firefox-main/rev/e7114bcf28158b46e516178c06201e4849201eba/servo/components/style/error_reporting.rs#285-287

/// `:scope` can have 3 meanings, but in all cases, the relationship is defined strictly by an ancestor-descendant
/// relationship. This means that any presence of sibling selectors to its right would make it never match.

It would be nice to have a section explaining this

Do you have any supporting links, references, or citations?

Firefox bugs that added the warning: https://bugzilla.mozilla.org/show_bug.cgi?id=1882379

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Content:CSSCascading Style Sheets docsneeds triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions