inSelector property

bool inSelector
getter/setter pair

Changes tokenization when in selectors. If true, it prevents identifiers from being treated as units. This would break things like ":lang(fr)" or the HTML (unknown) tag name "px", which is legal to use in a selector.

Implementation

// TODO(jmesserly): is this a problem elsewhere? "fr" for example will be
// processed as a "fraction" unit token, preventing it from working in
// places where an identifier is expected. This was breaking selectors like:
//     :lang(fr)
// The assumption that "fr" always means fraction (and similar issue with
// other units) doesn't seem valid. We probably should defer this
// analysis until we reach places in the parser where units are expected.
// I'm not sure this is tokenizing as described in the specs:
//     http://dev.w3.org/csswg/css-syntax/
//     http://dev.w3.org/csswg/selectors4/
bool inSelector = false;