Closed Bug 1425757 Opened 7 years ago Closed 7 years ago

Don't support a list of selectors in ::slotted yet

Categories

(Core :: CSS Parsing and Computation, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

Other browsers don't, and that allows them to use the rule hash for fast selector-matching.
If others don't... we probably should make the spec match it, and maybe add notes for future extension...
Comment on attachment 8937359 [details]
Bug 1425757: Don't support a list of selectors in ::slotted yet.

https://reviewboard.mozilla.org/r/208040/#review214378

::: servo/components/selectors/parser.rs
(Diff revision 1)
>          assert!(parse("::slotted(div + bar)").is_err());
>          assert!(parse("::slotted(div) + foo").is_err());
>          assert!(parse("div ::slotted(div)").is_ok());
>          assert!(parse("div + slot::slotted(div)").is_ok());
>          assert!(parse("div + slot::slotted(div.foo)").is_ok());
> -        assert!(parse("div + slot::slotted(.foo, bar, .baz)").is_ok());

Maybe changes to `assert!(parse(...).is_err());` and add a TODO here that if at some point we start supporting it again, we can simply flip the assertion here.

::: servo/components/style/selector_map.rs:418
(Diff revision 1)
>              Bucket::LocalName {
>                  name: &selector.name,
>                  lower_name: &selector.lower_name,
>              }
>          }
> +        Component::Slotted(ref selector) => find_bucket(selector.iter()),

I'm a bit uncertain about this. So a rule with `::slotted()` may be put into a bucket which is either for the originating slot element, or the assigned element. Would that cause any trouble in selector matching?

This may be worth a bit more comment, I guess.
Attachment #8937359 - Flags: review+
Depends on: 1426516
Priority: -- → P1
Could you file an issue to relevant spec to propose a spec change given the implementation status of this among browsers as well as the fact that doing it makes it easier to optimize?
Flags: needinfo?(emilio)
https://github.com/w3c/csswg-drafts/issues/2158

(Also, this landed in https://github.com/servo/servo/pull/19610)
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(emilio)
Resolution: --- → FIXED
Attachment #8937359 - Flags: review?(cam)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: