Skip to content

Conversation

moz-wptsync-bot
Copy link
Collaborator

This is as per the CSSWG resolution [1].

  • scope-invalidation.html: Adjust for & no longer inheriting scope start
    selector's specificity.
  • scope-specificity.html: Now equate @scope(#main) { & .b {} } with
    :where(#main) .b in terms of specificity.
  • scope-nesting.html:
    • test_nest_scope_end: Now behaves identically to
      test_nest_scope_end_implicit_scope
    • test_inner_nest: Now behaves identically to
      test_parent_in_pseudo_scope
    • test_parent_pseudo_in_nested_scope_end: Removed; there's no equivalence
      with implicit :scope
    • test_insert_ampersand_rule_within_scope: Insert the selector using &
      before and after the selector using implicit scope selector, since
      order of apperance matters.

[1] w3c/csswg-drafts#9740

Differential Revision: https://phabricator.services.mozilla.com/D257704

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1975531
gecko-commit: b7593b87da93868f2b9302b5de723110eb96428d
gecko-reviewers: firefox-style-system-reviewers, emilio

…scope.

This is as per the CSSWG resolution [1].

* scope-invalidation.html: Adjust for `&` no longer inheriting scope start
  selector's specificity.
* scope-specificity.html: Now equate `@scope(#main) { & .b {} }` with
  `:where(#main) .b` in terms of specificity.
* scope-nesting.html:
  * `test_nest_scope_end`: Now behaves identically to
    `test_nest_scope_end_implicit_scope`
  * `test_inner_nest`: Now behaves identically to
    `test_parent_in_pseudo_scope`
  * `test_parent_pseudo_in_nested_scope_end`: Removed; there's no equivalence
    with implicit `:scope`
  * `test_insert_ampersand_rule_within_scope`: Insert the selector using &
    before and after the selector using implicit scope selector, since
    order of apperance matters.

[1] w3c/csswg-drafts#9740

Differential Revision: https://phabricator.services.mozilla.com/D257704

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1975531
gecko-commit: b7593b87da93868f2b9302b5de723110eb96428d
gecko-reviewers: firefox-style-system-reviewers, emilio
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Firefox project.

@nt1m
Copy link
Member

nt1m commented Jul 18, 2025

cc @mdubet to review from WebKit

@lutien
Copy link
Contributor

lutien commented Jul 28, 2025

@mdubet, could you take a look?

@scope (.a) to (& > &) {
* { z-index:1; }
/* (.b) behaves like (:where(:scope) .b), due & mapping to :where(:scope).*/
@scope (.a) to (& .b) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to remove the > child selector here ?

</div>
</template>
<script>
test((t) => {
t.add_cleanup(() => main.replaceChildren());
main.append(test_inner_nest.content.cloneNode(true));

assert_equals(getComputedStyle(inner1).zIndex, 'auto');
assert_equals(getComputedStyle(inner2).zIndex, '1');
assert_equals(getComputedStyle(div).zIndex, '2');
}, 'Nesting-selector in the scope\'s <stylesheet>');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the new goal of the test to verify that scoped element are inclusive descendant of the scoping root ? If so, should we rename the test ?

@nt1m
Copy link
Member

nt1m commented Aug 4, 2025

cc @lilles for Chromium review too

@lilles
Copy link
Member

lilles commented Aug 4, 2025

cc @lilles for Chromium review too

@andruud

@andruud
Copy link
Contributor

andruud commented Aug 4, 2025

Test changes LGTM, but like I said in the CSSWG discussion, we may not actually be able to make this change for web compat reasons. By default, this should cause the affected tests to be dropped from interop. web-platform-tests/interop#604

@nt1m
Copy link
Member

nt1m commented Aug 4, 2025

This is precisely what I'm trying to assess here by pinging individual vendors :) If there's consensus that the change is OK, then we can include it.

If this change is not OK, we should revert the spec resolution as well as this WPT change.

@andruud
Copy link
Contributor

andruud commented Aug 7, 2025

The change is probably OK; @scope doesn't have wide-spread usage yet after all (0.11% of Chrome page loads). I've added a use-counter to check if people are using & in @scope at all. I'll check the data in October, and raise a CSSWG issue if there's a problem. I the meantime, we can just sit tight with this WPT change as-is.

@nt1m
Copy link
Member

nt1m commented Aug 12, 2025

@dshin-moz @emilio Could you look at the comments above? Seems OK to merge given everyone's comments here, but just want to make sure you see them before I do

@dshin-moz
Copy link
Contributor

Sorry, this fell off my radar. Due to me not having push permissions, I've created #54268 addressing the comments.

Differential Revision: https://phabricator.services.mozilla.com/D262990

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1975531
gecko-commit: 3ab10e3da283b493106f9f3c4e03d87afcf60c3d
gecko-reviewers: firefox-style-system-reviewers, emilio
@dshin-moz
Copy link
Contributor

I was informed on how to properly update this review (Thanks @jgraham!). Review comments are addressed in this review. Closing #54268.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants