Re: [csswg-drafts] [css-cascade] What is the appropriate syntax for appending to nested layers? (#5791)

Stating my arguments from the meeting a little more explicitly:

* Using space-separation to indicate hierarchy occurs (I *think*) nowhere in CSS values (only in Selectors; see next point). In *almost every* instance, space-separated values don't even imply an ordering; they're almost always re-orderable. (`color-scheme` is the first exception that comes to mind where order does matter.)
* Space-separation *is* used in Selectors, where it represents the descendant combinator. But if Selectors are the analogy we're going for here, then the descendant combinator *is the wrong combinator to use* - it implies an arbitrary amount of separation between the items on either side. We'd want the child combinator `>` to invoke the correct analogy.
* But relying on a Selector analogy is a little fraught, anyway. 
 * First, it reuses the visual metaphor of something that lives in the same conceptual space, and very similar syntactic space - Selectors are already there, but these *are not Selectors*, and I don't think it's great to have them be so visually confusable.
 * Second, it's a broken analogy. These don't work like Selectors in *any other way* than referencing a hierarchy. The "nodes" don't have any qualities besides their name (and I don't expect us to ever want to add anything else to them), and you can't link them with any other combinator - no descendants, no siblings. When you draw on a metaphor you'll rarely get a perfect match, but if you only match in the *one* aspect and nothing else, it often causes more confusion than it resolves.
* Using the period instead leans on the metaphor of nested objects, using syntax common to most languages invented in the past half-century (especially when weighted toward languages webdevs are likely to know, notably JS).

 It does collide with Selector syntax as well (a compound selector with a type selector and multiple class selectors), but we're purposely not drawing on that metaphor; this is a separator, not an identifying prefix.


---

And carrying over a detail from florian's comment in IRC, I expect us to impose a "no whitespace" restriction around the period: `foo.bar` is good, `foo . bar` is invalid.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5791#issuecomment-768477928 using your GitHub account


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

Received on Wednesday, 27 January 2021 18:18:21 UTC