Skip to content

[css-nesting][selectors] Behavior of & with a default namespace? #9806

Open
@Loirooriol

Description

@Loirooriol

https://drafts.csswg.org/selectors/#type-nmsp

If a default namespace is declared, compound selectors without type selectors in them still only match elements in that default namespace.

https://drafts.csswg.org/css-nesting/#nest-selector defines a & selector (which is not a type selector).

Then, consider

@namespace url("http://example.com/foo");
@namespace svg url("http://www.w3.org/2000/svg");
svg|a {
  &:hover {}
}

&:hover has no type selector, so as per Selectors, it won't match a svg|a:hover. That's how Gecko, Blink and WebKit behave.

But I think it's supposed to match to be consistent with what @tabatkins is saying in #5684 and #9804

Possibly, Selectors should say something like

If a default namespace is declared, compound selectors without type selectors in them still only match elements in that default namespace.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions