Skip to content

Latest commit

 

History

History
172 lines (99 loc) · 3.41 KB

SyntaxDefinition.md

File metadata and controls

172 lines (99 loc) · 3.41 KB

css-selector-parser / Exports / SyntaxDefinition

Interface: SyntaxDefinition

CSS Selector Syntax Definition can be used to define custom CSS selector parsing rules.

Table of contents

Properties

Properties

attributes

Optional attributes: false | { caseSensitivityModifiers?: string[] ; operators?: string[] ; unknownCaseSensitivityModifiers?: "accept" | "reject" }

CSS Attribute Selector.

Example

[href="#"]

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Attribute_selectors


baseSyntax

Optional baseSyntax: CssLevel

When specified, syntax will be based on the specified predefined CSS standard. If not specified, syntax will be defined from scratch.


classNames

Optional classNames: boolean

CSS Class Names

Example

.element.highlighted

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors


combinators

Optional combinators: string[]

CSS selector rule nesting combinators.

Example

div.class > span

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Combinators


ids

Optional ids: boolean

CSS IDs (yes, there can be multiple).

Example

#root#root

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors


namespace

Optional namespace: boolean | { wildcard?: boolean }

CSS3 Namespaces.

Example

ns|div

See

https://www.w3.org/TR/css3-namespace/


pseudoClasses

Optional pseudoClasses: false | { definitions?: { Formula: undefined | string[] ; FormulaOfSelector: undefined | string[] ; NoArgument: undefined | string[] ; Selector: undefined | string[] ; String: undefined | string[] } ; unknown?: "accept" | "reject" }

CSS Pseudo-classes.

Example

:nth-child(2n+1)

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Pseudo-classes_and_pseudo-elements


pseudoElements

Optional pseudoElements: false | { definitions?: string[] | { NoArgument: undefined | string[] ; Selector: undefined | string[] ; String: undefined | string[] } ; notation?: "both" | "singleColon" | "doubleColon" ; unknown?: "accept" | "reject" }

CSS Pseudo-elements.

Example

::before

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Pseudo-classes_and_pseudo-elements


tag

Optional tag: boolean | { wildcard?: boolean }

CSS Tag (type).

Example

div

See

https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Type_Class_and_ID_Selectors