Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-contain] unclear about counter() in 'contain: style' context #9116

Closed
danielsakhapov opened this issue Jul 25, 2023 · 5 comments
Closed
Labels
Closed Accepted by Editor Discretion Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-contain-2 Current Work Tested Memory aid - issue has WPT tests

Comments

@danielsakhapov
Copy link
Contributor

I'm confused a bit about the behavior of content: counter() in the context of 'contain: style'.

The spec says:

However, the counter() and counters() value of the content property is not itself scoped, and can refer to counters established outside of the subtree.

My interpretation is that we can leave the style containment scope for search of the counter value.
And the example after the text above shows the same.

But the test, which all the browsers pass tells the other story, it doesn't allow the access to the reset on body element.

So, my question - is my understanding incorrect? If so, why we can access the 1 for div::before in example, doesn't it cross the style containment boundary?

@Loirooriol
Copy link
Contributor

The idea is that you can read across the style containment boundary, but not modify.

@danielsakhapov
Copy link
Contributor Author

danielsakhapov commented Jul 25, 2023

Right, but then the wpt test is wrong, isn't it? Counter at div::after should access the 13 from the <body>?

@Loirooriol
Copy link
Contributor

TBH the implementations are quite broken (e.g. Blink says 0 for counter() but 13 for counters()), and the spec seems problematic, see #5175

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 4, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Sep 5, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary
and the first counter-increment will create a counter, that will be
inherited by its siblings, so class="contain" element will have a
counter from its previous sibling, and counters() inside
the style containment scopes will have access to this counter.

Bug: 990657
Change-Id: I9ff784577d37b7a936e96a21548006b8b0d7848d
aarongable pushed a commit to chromium/chromium that referenced this issue Oct 2, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary
and the first counter-increment will create a counter, that will be
inherited by its siblings, so class="contain" element will have a
counter from its previous sibling, and counters() inside
the style containment scopes will have access to this counter.

Bug: 990657
Change-Id: I9ff784577d37b7a936e96a21548006b8b0d7848d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4839207
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1203928}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 2, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 2, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
aarongable pushed a commit to chromium/chromium that referenced this issue Oct 3, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 3, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 3, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 6, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 6, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 6, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 6, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 13, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Commit-Queue: Daniil Sakhapov <sakhapovchromium.org>
Cr-Commit-Position: refs/heads/main{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799

UltraBlame original commit: 2a2fdf7316964d175c39754df1bd348a9da555f1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 13, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Commit-Queue: Daniil Sakhapov <sakhapovchromium.org>
Cr-Commit-Position: refs/heads/main{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799

UltraBlame original commit: 1d596d12047a698634b528896d66aa0b3d116cf5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 13, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Commit-Queue: Daniil Sakhapov <sakhapovchromium.org>
Cr-Commit-Position: refs/heads/main{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799

UltraBlame original commit: 2a2fdf7316964d175c39754df1bd348a9da555f1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 13, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Commit-Queue: Daniil Sakhapov <sakhapovchromium.org>
Cr-Commit-Position: refs/heads/main{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799

UltraBlame original commit: 1d596d12047a698634b528896d66aa0b3d116cf5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 13, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Commit-Queue: Daniil Sakhapov <sakhapovchromium.org>
Cr-Commit-Position: refs/heads/main{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799

UltraBlame original commit: 2a2fdf7316964d175c39754df1bd348a9da555f1
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 13, 2023
Automatic update from web-platform-tests
Fix WPT CSS Counters test

As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futharkchromium.org>
Commit-Queue: Daniil Sakhapov <sakhapovchromium.org>
Cr-Commit-Position: refs/heads/main{#1204571}

--

wpt-commits: dcb79ca1856efaa5ac6b455d1f96f63e3038e663
wpt-pr: 41799

UltraBlame original commit: 1d596d12047a698634b528896d66aa0b3d116cf5
Lightning00Blade pushed a commit to Lightning00Blade/wpt that referenced this issue Dec 11, 2023
As per:
https://drafts.csswg.org/css-contain/#example-6932a400
and
w3c/csswg-drafts#9116
counter() and counters() can cross the style containment boundary,
so the result should be 13 from the body's counter-reset.

Bug: 990657
Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204571}
@fantasai fantasai added the css-contain-2 Current Work label Jan 9, 2024
@frivoal frivoal added Closed Accepted by Editor Discretion Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. labels May 30, 2024
@frivoal
Copy link
Collaborator

frivoal commented May 30, 2024

The test has since been fixed, and the value of the counter on body can indeed be read.

@frivoal frivoal closed this as completed May 30, 2024
@frivoal frivoal added the Tested Memory aid - issue has WPT tests label May 30, 2024
@frivoal
Copy link
Collaborator

frivoal commented May 30, 2024

Note: the results of that test might change (for other reasons) depending on the outcome of #5175, though current interop suggests that this will remain correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by Editor Discretion Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-contain-2 Current Work Tested Memory aid - issue has WPT tests
Projects
None yet
Development

No branches or pull requests

4 participants