css-what
- Version 6.1.0
- Published
- 66 kB
- No dependencies
- BSD-2-Clause license
Install
npm i css-what
yarn add css-what
pnpm add css-what
Overview
a CSS selector parser
Index
Variables
Functions
Interfaces
Enums
Type Aliases
Variables
variable IgnoreCaseMode
const IgnoreCaseMode: { readonly Unknown: null; readonly QuirksMode: 'quirks'; readonly IgnoreCase: true; readonly CaseSensitive: false;};
Modes for ignore case.
This could be updated to an enum, and the object is the current stand-in that will allow code to be updated without big changes.
Functions
function isTraversal
isTraversal: (selector: Selector) => selector is Traversal;
Checks whether a specific selector is a traversal. This is useful eg. in swapping the order of elements that are not traversals.
Parameter selector
Selector to check.
function parse
parse: (selector: string) => Selector[][];
Parses
selector
, optionally with the passedoptions
.Parameter selector
Selector to parse.
Parameter options
Options for parsing.
Returns
Returns a two-dimensional array. The first dimension represents selectors separated by commas (eg.
sub1, sub2
), the second contains the relevant tokens for that selector.
function stringify
stringify: (selector: Selector[][]) => string;
Turns
selector
back into a string.Parameter selector
Selector to stringify.
Interfaces
interface AttributeSelector
interface AttributeSelector {}
interface PseudoElement
interface PseudoElement {}
interface PseudoSelector
interface PseudoSelector {}
interface TagSelector
interface TagSelector {}
interface UniversalSelector
interface UniversalSelector {}
Enums
enum AttributeAction
enum AttributeAction { Any = 'any', Element = 'element', End = 'end', Equals = 'equals', Exists = 'exists', Hyphen = 'hyphen', Not = 'not', Start = 'start',}
enum SelectorType
enum SelectorType { Attribute = 'attribute', Pseudo = 'pseudo', PseudoElement = 'pseudo-element', Tag = 'tag', Universal = 'universal', Adjacent = 'adjacent', Child = 'child', Descendant = 'descendant', Parent = 'parent', Sibling = 'sibling', ColumnCombinator = 'column-combinator',}
member Adjacent
Adjacent = 'adjacent'
member Attribute
Attribute = 'attribute'
member Child
Child = 'child'
member ColumnCombinator
ColumnCombinator = 'column-combinator'
member Descendant
Descendant = 'descendant'
member Parent
Parent = 'parent'
member Pseudo
Pseudo = 'pseudo'
member PseudoElement
PseudoElement = 'pseudo-element'
member Sibling
Sibling = 'sibling'
member Tag
Tag = 'tag'
member Universal
Universal = 'universal'
Type Aliases
type DataType
type DataType = Selector[][] | null | string;
type Selector
type Selector = | PseudoSelector | PseudoElement | AttributeSelector | TagSelector | UniversalSelector | Traversal;
type TraversalType
type TraversalType = | SelectorType.Adjacent | SelectorType.Child | SelectorType.Descendant | SelectorType.Parent | SelectorType.Sibling | SelectorType.ColumnCombinator;
Package Files (4)
Dependencies (0)
No dependencies.
Dev Dependencies (11)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/css-what
.
- Markdown[](https://www.jsdocs.io/package/css-what)
- HTML<a href="https://www.jsdocs.io/package/css-what"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2189 ms. - Missing or incorrect documentation? Open an issue for this package.