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

Re: [csswg-drafts] [css-variables] Whether to support override a property using itself? (#876)

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Wed, 28 Jul 2021 20:30:13 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-888600843-1627504212-sysbot+gh@w3.org>
This isn't possible given how CSS parsing works - if you use the same property multiple times in a rule, all but the latest is automatically discarded. So in your example, only the `--main-color: var(--main-color, #666);` gets seen by CSS.

(And as it turns out, this doesn't work either - it does *not* set `--main-color` to `#666`, it makes it the guaranteed-invalid value, since the property is involved in a cycle with itself and thus is overridden to be the guaranteed-invalid value.)

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 28 July 2021 20:30:15 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:27:25 UTC