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-values] unify CSS wide keywords and defaulting keywords #7170

Closed
yisibl opened this issue Mar 24, 2022 · 3 comments
Closed

[css-values] unify CSS wide keywords and defaulting keywords #7170

yisibl opened this issue Mar 24, 2022 · 3 comments

Comments

@yisibl
Copy link
Contributor

yisibl commented Mar 24, 2022

These keyword definitions are currently scattered throughout the specification, making it easy for other CSS parsers or engine implementers to miss them. e.g.

var wideKeywords = map[string]bool{
	"initial": true,
	"inherit": true,
	"unset":   true,
}
match &*value.to_ascii_lowercase() {
    "initial" | "inherit" | "unset" | "revert" | "default" => {
        return Err(Error::new(span, ErrorKind::InvalidCustomIdent(raw)));
    }
    _ => {}
}
const globalKeywords = ['inherit', 'initial', 'unset'];

css-values-4

https://www.w3.org/TR/css-values-4/#common-keywords

Defined:

  • initial
  • inherit
  • unset

css-cascade-4

https://drafts.csswg.org/css-cascade/#defaulting-keywords

Defined:

  • initial
  • inherit
  • unset
  • revert

css-cascade-5

https://drafts.csswg.org/css-cascade-5/#revert-layer

Defined:

  • initial
  • inherit
  • unset
  • revert
  • revert-layer

css-values-4

https://www.w3.org/TR/css-values-4/#ref-for-css-wide-keywords

The CSS-wide keywords are not valid <custom-ident>s. The default keyword is reserved and is also not a valid <custom-ident>

There is a default keyword.

@tabatkins
Copy link
Member

The definitions are already unified in the Cascade specs (and later levels replace preceding levels, so Cascade 5 is the canonical definition). Values merely mentions them, and points to Cascade for their definition; Fonts mentions them in an example (including the reserved "default" keyword)

@yisibl
Copy link
Contributor Author

yisibl commented Mar 27, 2022

@tabatkins Thank you for your reply.

Yes, the CSS fonts spec mentions the terms common-keywords|CSS-wide keyword, so can we change them all to CSS-wide keyword in Cascade 5? Too many terms can be confusing and detrimental to communication.

Any identifier which could be misinterpreted as a pre-defined keyword in the font-family value definition, or the common-keywords|CSS-wide keyword values, is not allowed.

Also is it possible to add the "default" keyword to the Explicit Defaulting section in Cascade 5?

@fantasai
Copy link
Collaborator

Hi @yisibl, we've refactored the spec text around CSS-wide keywords in 9b95cab

For “default”, this is merely excluded from the <custom-ident> production, since it is not a valid CSS-wide keyword anywhere. We are also discussing adding additional keywords to the <custom-ident> exclusion list in #7431.

Closing out this issue, but let us know if there are any remaining problem.

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