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] "scoped to an element" definition is unused (?) #2845

Closed
dholbert opened this issue Jun 28, 2018 · 4 comments
Closed

[css-contain] "scoped to an element" definition is unused (?) #2845

dholbert opened this issue Jun 28, 2018 · 4 comments

Comments

@dholbert
Copy link
Member

dholbert commented Jun 28, 2018

In the style containment spec-text...
https://drafts.csswg.org/css-contain/#containment-style
...there's an explanation of what a "scoped property" is, and how it "has its effects scoped to a particular element or sub-tree." Most of this explanation is about what it means to be scoped to an element vs. scoped to a sub-tree.

However: this distinction doesn't seem to matter, because the spec only uses the "scoped to a sub-tree" behavior:

The counter-increment and counter-set properties must be scoped to the element’s sub-tree
[...]
The effects of the content property’s open-quote, close-quote, no-open-quote and no-close-quote must be scoped to the element’s sub-tree.

So the definition of "scoped to an element" seems to be unused, which is a bit confusing.

If it's not going to be used, perhaps it'd be clearer to skip that definition, and dive directly into explaining what it means to scope to a sub-tree, rather than explaining an unused different term first?

(CC @frivoal @tabatkins )

@dholbert dholbert changed the title [css-contain] "scoped property" definition is largely unused (?) [css-contain] "scoped to an element" definition is unused (?) Jun 28, 2018
@Loirooriol
Copy link
Contributor

My guess was that the definition is provided so that other specs can use it, but I agree it's confusing. I already complained in #2349.

@frivoal
Copy link
Collaborator

frivoal commented Jun 29, 2018

My guess was that the definition is provided so that other specs can use it.

Correct.

I agree it's confusing. I already complained in #2349.

There was an attempt at making it less confusing. Not good enough I guess. Any suggestion?

@Loirooriol
Copy link
Contributor

Loirooriol commented Jun 29, 2018

If reordering the definitions makes it harder to explain, I would at least separate them, like

A property can have its effects scoped to a particular element or subtree.

  • If scoped to an element, it must act as if the scoping element was the root of the document for the purpose of evaluating the property’s effects: any uses of the property outside the scoping element must have no effect on the uses of the property on or in the scoping element, and vice versa.
  • If scoped to a sub-tree, it’s the same, except the scoping element itself is counted as "outside" the tree, like the rest of the document, and the effects of the property on that element are unaffected by scoping. 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.

And then link directly to "scoped to a sub-tree"

The counter-increment and counter-set properties must be scoped to the element’s sub-tree and create a new counter.

Currently if you click the link you are pointed to "scoped to an element", can be misleading.

@dholbert
Copy link
Member Author

It might also be useful to add something to clarify why we're providing this unused definition -- e.g.:

Note: the "scoped to an element" behavior is not used in this specification. This behavior is defined here on the assumption that future CSS specifications may want to use it when defining how they interact with style containment.

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

No branches or pull requests

3 participants