csstree / csstree

A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations

Home Page:https://csstree.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A single reverse solidus before EOF is tokenized incorrectly

romainmenke opened this issue · comments

csstree tokenizes this as a delim token with value \ which is incorrect.

Example :

<div style="--foo:\">

In Chrome this has : cssText: "--foo:�;"

This is tokenized as :

  1. \ before EOF starts a valid escape
  2. consume an ident
  3. EOF
  4. return U+FFFD REPLACEMENT CHARACTER

https://www.w3.org/TR/css-syntax-3/#consume-an-escaped-code-point