Crate simplecss[][src]

Expand description

A simple CSS 2.1 parser and selector.

This is not a browser-grade CSS parser. If you need one, use cssparser + selectors.

Since it’s very simple we will start with limitations:

Limitations

  • At-rules are not supported. They will be skipped during parsing.
  • Property values are not parsed. In CSS like * { width: 5px } you will get a width property with a 5px value as a string.
  • CDO/CDC comments are not supported.
  • Parser is case sensitive. All keywords must be lowercase.
  • Unicode escape, like \26, is not supported.

Features

  • Selector matching support.
  • The rules are sorted by specificity.
  • !import parsing support.
  • Has a high-level parsers and low-level, zero-allocation tokenizers.
  • No unsafe.

Structs

A declaration.

A declaration tokenizer.

A rule.

A selector.

A selector tokenizer.

A style sheet.

A position in text.

Enums

An attribute selector operator.

A list of possible errors.

A pseudo-class.

A selector token.

Traits

A trait to query an element node metadata.