W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

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

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Wed, 27 Jan 2021 18:18:19 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-768477928-1611771498-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:38 UTC