"unset" does not compute to "initial" for custom properties

RESOLVED INVALID

Status

()

Core
CSS Parsing and Computation
RESOLVED INVALID
3 years ago
2 years ago

People

(Reporter: philip, Unassigned)

Tracking

43 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36

Steps to reproduce:

Visit the following codepen:
http://codepen.io/anon/pen/EVdXob


Actual results:

The text was red.


Expected results:

The text should not have been red.

If you change the declaration from `--color: unset` to `--color: initial`, it works. And the spec for unset says that it should compute to "inherit" for inheritable properties, which custom properties are.

https://drafts.csswg.org/css-cascade-4/#valdef-all-unset

Updated

3 years ago
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
I'm not sure I follow.

1)  Custom properties are inheritable properties.
2)  For inheritable properties, 'unset' should compute to 'inherit'.

We agree on those two statements, looks like.  So the behavior of the given testcase, which is:

  <style>
    :root { --color: red; }
    body { --color: unset; }
    p { color: var(--color); }
  </style>
  <p>Some text</p>

should be the the same as this testcase:

  <style>
    :root { --color: red; }
    body { --color: inherit; }
    p { color: var(--color); }
  </style>
  <p>Some text</p>

or, indeed, this testcase:

  <style>
    :root { --color: red; }
    p { color: var(--color); }
  </style>
  <p>Some text</p>

(because that's the whole idea of "unset": make it look as if it's not set at all).  In all of those the text should be 'red'.  Where does 'initial' come into this and why do you think the text should not be red?
Flags: needinfo?(philip)
I agree with bz's reasoning.  Given the lack of response, marking as INVALID since I believe our behavior is correct, but if you disagree feel free to reopen with a rationale.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
(Reporter)

Comment 3

2 years ago
Ahh, yes, sorry, you are correct.

And sorry to not reply sooner. I never got an email notification that anyone had replied to the bug.
Flags: needinfo?(philip)
You need to log in before you can comment on or make changes to this bug.