• Version 1.4.1
  • Published
  • 38.9 kB
  • No dependencies
  • MIT license


npm i css-selector-parser
yarn add css-selector-parser
pnpm add css-selector-parser


Just a CSS selector parser.



class CssSelectorParser

class CssSelectorParser {}

    property attrEqualityMods

    protected attrEqualityMods: { [mod: string]: true };

      property pseudos

      protected pseudos: { [pseudo: string]: PseudoSelectorType };

        property ruleNestingOperators

        protected ruleNestingOperators: { [operator: string]: true };

          property substitutesEnabled

          protected substitutesEnabled: boolean;

            method disableSubstitutes

            disableSubstitutes: () => this;

              method enableSubstitutes

              enableSubstitutes: () => this;

                method parse

                parse: (str: string) => Selector;

                  method registerAttrEqualityMods

                  registerAttrEqualityMods: (...mods: string[]) => this;

                    method registerNestingOperators

                    registerNestingOperators: (...operators: string[]) => this;

                      method registerNumericPseudos

                      registerNumericPseudos: (...pseudos: string[]) => this;

                        method registerSelectorPseudos

                        registerSelectorPseudos: (...pseudos: string[]) => this;

                          method render

                          render: (path: Selector) => string;

                            method unregisterAttrEqualityMods

                            unregisterAttrEqualityMods: (...mods: string[]) => this;

                              method unregisterNestingOperators

                              unregisterNestingOperators: (...operators: string[]) => this;

                                method unregisterNumericPseudos

                                unregisterNumericPseudos: (...pseudos: string[]) => this;

                                  method unregisterSelectorPseudos

                                  unregisterSelectorPseudos: (...pseudos: string[]) => this;


                                    interface Rule

                                    interface Rule {}

                                      property attrs

                                      attrs: RuleAttr[];

                                        property classNames

                                        classNames?: string[];

                                          property id

                                          id?: string;

                                            property nestingOperator

                                            nestingOperator: string | null;

                                              property pseudos

                                              pseudos: RulePseudo[];

                                                property rule

                                                rule?: Rule;

                                                  property tagName

                                                  tagName?: string;

                                                    property type

                                                    type: 'rule';

                                                      interface RuleSet

                                                      interface RuleSet {}

                                                        property rule

                                                        rule: Rule;

                                                          property type

                                                          type: 'ruleSet';

                                                            interface Selectors

                                                            interface Selectors {}

                                                              property selectors

                                                              selectors: RuleSet[];

                                                                property type

                                                                type: 'selectors';

                                                                  Type Aliases

                                                                  type AttrValueType

                                                                  type AttrValueType = 'string' | 'substitute';

                                                                    type PseudoSelectorType

                                                                    type PseudoSelectorType = 'numeric' | 'selector';

                                                                      type RuleAttr

                                                                      type RuleAttr = {
                                                                      name: string;
                                                                      } & (
                                                                      | {}
                                                                      | {
                                                                      operator: string;
                                                                      valueType: AttrValueType;
                                                                      value: string;

                                                                        type RulePseudo

                                                                        type RulePseudo = {
                                                                        name: string;
                                                                        } & (
                                                                        | {
                                                                        valueType: 'selector';
                                                                        value: Selector;
                                                                        | {
                                                                        valueType: 'string' | 'substitute' | 'numeric';
                                                                        value: string;

                                                                          type Selector

                                                                          type Selector = Selectors | RuleSet;

                                                                            type SelectorEntity

                                                                            type SelectorEntity = Selectors | RuleSet | Rule;

                                                                              Package Files (3)

                                                                              Dependencies (0)

                                                                              No dependencies.

                                                                              Dev Dependencies (4)

                                                                              Peer Dependencies (0)

                                                                              No peer dependencies.


                                                                              To add a badge like this onejsDocs.io badgeto 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-selector-parser.

                                                                              • Markdown
                                                                              • HTML
                                                                                <a href="https://www.jsdocs.io/package/css-selector-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>