[csswg-drafts] [css-values-5] sibling-index()/count() should return 1, not 0, when the tree ref fails (#13736)

tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values-5] sibling-index()/count() should return 1, not 0, when the tree ref fails ==
The [Tree-Counting Functions](https://drafts.csswg.org/css-values-5/#tree-counting) use tree-scoped name/ref machinery to avoid exposing DOM information from the shadow up to the light tree. 

The spec currently says that when this mechanism successfully blocks a tree-counting function, it causes it to resolve to 0. But 0 is not a value that can ever be returned by tree-counting functions normally; the smallest possible value is 1, when the element is by itself, and thus is also index 1 among its siblings.

I don't think there's a good reason to return 0 in particular here, and doing so would screw up code that, does, say, `calc( (sibling-index() - 1) * 20px)` to give a gradually-increasing value; it would get `-20px` with the current spec when the ref failed.

I think we should return 1 for both of these functions.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13736 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 27 March 2026 21:28:05 UTC