Skip to content

Commit

Permalink
lexer: don't treat default as valid value for <custom-ident>
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Sep 5, 2017
1 parent 940d264 commit ade1ad1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/lexer/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,25 @@ function expression(node) {
}

// https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident
// https://drafts.csswg.org/css-values-4/#identifier-value
function customIdent(node) {
if (node.data.type !== 'Identifier') {
return false;
}

var name = node.data.name.toLowerCase();

// can't be a global CSS value
// § 3.2. Author-defined Identifiers: the <custom-ident> type
// The CSS-wide keywords are not valid <custom-ident>s
if (name === 'unset' || name === 'initial' || name === 'inherit') {
return false;
}

// The default keyword is reserved and is also not a valid <custom-ident>
if (name === 'default') {
return false;
}

// TODO: ignore property specific keywords (as described https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident)

return true;
Expand Down

0 comments on commit ade1ad1

Please sign in to comment.