Closed Bug 1452640 Opened 6 years ago Closed 6 years ago

Implement functional :host(..) selector.

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

      No description provided.
Comment on attachment 8966386 [details]
Bug 1452640: Implement the functional :host(..) selector.

https://reviewboard.mozilla.org/r/235088/#review240806

::: servo/components/selectors/parser.rs:824
(Diff revision 1)
> +    /// NOTE(emilio): This should support a list of selectors, but as of this
> +    /// writing no other browser does, and that allows them to put ::slotted()
> +    /// in the rule hash, so we do that too.

I suppose you mean "to put **`::host()`**"?

::: servo/components/selectors/parser.rs:1137
(Diff revision 1)
>              Scope => dest.write_str(":scope"),
> -            Host => dest.write_str(":host"),
> +            Host(ref selector) => {
> +                dest.write_str(":host")?;
> +                if let Some(ref selector) = *selector {
> +                    dest.write_char('(')?;
> +					selector.to_css(dest)?;

The indention looks weird.

::: servo/components/style/invalidation/element/invalidator.rs:538
(Diff revision 1)
> -        // element state / attribute invalidations (it's needed for XBL though,
> -        // due to the weird way the anon content there works (it doesn't block
> -        // combinators)).
> +        // correctly on :host(..) changes. We could not do this instead and add
> +        // a third kind of invalidation list instead, that walks shadow root
> +        // children, but it's not clear it's worth it.

I find this sentence pretty hard to follow...

Maybe something like:
> Instead of doing this, we could add a third kind of invalidation list that walks shadow root children, but it's not clear it's worth it.
Attachment #8966386 - Flags: review?(xidorn+moz) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/77d5f1b8d04f
Update test expectations for :host(..). r=me
https://hg.mozilla.org/integration/autoland/rev/00ac14e01121
Test descendant invalidation for :host(..). r=xidorn
https://hg.mozilla.org/mozilla-central/rev/77d5f1b8d04f
https://hg.mozilla.org/mozilla-central/rev/00ac14e01121
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Created web-platform-tests PR https://github.com/w3c/web-platform-tests/pull/10408 for changes under testing/web-platform/tests
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: