- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Wed, 12 Jun 2024 15:56:40 +0000
- To: public-css-archive@w3.org
Anyway, quoting the spec: > When considering the effects of the scoped property on elements inside the subtree, the element at the base of the subtree is treated as if it was the root of the document. So, each child of the scoper acts like they're a root (no parent, but possibly siblings). This should result in [the spec example](https://drafts.csswg.org/css-contain/#example-21ca5120) - the first child with `counter-increment` sees that there's no counter of that name (because it's root-like) and creates a fresh counter, while the second child inherits its "foo" counter from its preceding sibling. The test given in [the OP](https://github.com/w3c/csswg-drafts/issues/5175#issue-631912976) should in fact return 1 and 1, but for boring reasons - because the element establishing the counter is the *grandchild* of the scoper (the ::before pseudo of the scoper's children), the first one establishes a fresh counter (on the ::before), and then the second one also establishes a fresh counter, because it doesn't see any counter coming from its parent *or* its previous sibling. Similarly, the test given in [Oriol's comment](https://github.com/w3c/csswg-drafts/issues/5175#issuecomment-1380898285) should indeed be 10, 10.1, and 10.1 - the first scoped child hasn't touched the counters, so `counters()` only sees the one counter established on the parent. (Note that the `counter()`/`counters()` functions are explicitly *not* scoped in their effects.) Then the second and third child act like the previous paragraph - each one establishes a counter on its ::before child, so the next one doesn't see that counter and creates another fresh one. ------- Ah, and the example cited in Oriol's comment was fixed in <https://github.com/w3c/csswg-drafts/commit/ca36447eb4f0b4ce8395523a3c7f7495479cf337>, which was associated with a near-dupe in #9192. So, aside from the fact that Chrome's current behavior is super broken in an exceedingly bizarre way, the spec seems to be all fixed up by now? -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5175#issuecomment-2163398603 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 12 June 2024 15:56:42 UTC