postcss-selector-parser

  • Version 6.1.0
  • Published
  • 186 kB
  • 2 dependencies
  • MIT license

Install

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

Overview

> Selector parser with built in methods for working with selector strings.

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable ATTRIBUTE

const ATTRIBUTE: globalThis.String;

    variable CLASS

    const CLASS: globalThis.String;

      variable COMBINATOR

      const COMBINATOR: globalThis.String;

        variable COMMENT

        const COMMENT: globalThis.String;

          variable ID

          const ID: globalThis.String;

            variable NESTING

            const NESTING: globalThis.String;

              variable PSEUDO

              const PSEUDO: globalThis.String;

                variable ROOT

                const ROOT: globalThis.String;

                  variable SELECTOR

                  const SELECTOR: globalThis.String;

                    variable STRING

                    const STRING: globalThis.String;

                      variable TAG

                      const TAG: globalThis.String;

                        variable UNIVERSAL

                        const UNIVERSAL: globalThis.String;

                          Functions

                          function attribute

                          attribute: (opts: AttributeOptions) => Attribute;

                            function className

                            className: (opts: NamespaceOptions) => ClassName;

                              function combinator

                              combinator: (opts: NodeOptions) => Combinator;

                                function comment

                                comment: (opts: NodeOptions) => Comment;

                                  function id

                                  id: (opts: any) => any;

                                    function isAttribute

                                    isAttribute: (node: any) => node is Attribute;

                                      function isClassName

                                      isClassName: (node: any) => node is ClassName;

                                        function isCombinator

                                        isCombinator: (node: any) => node is Combinator;

                                          function isComment

                                          isComment: (node: any) => node is Comment;

                                            function isContainer

                                            isContainer: (node: any) => node is Selector | Root | Pseudo;

                                              function isIdentifier

                                              isIdentifier: (node: any) => node is Identifier;

                                                function isNamespace

                                                isNamespace: (node: any) => node is Tag | Attribute;

                                                  function isNesting

                                                  isNesting: (node: any) => node is Nesting;

                                                    function isNode

                                                    isNode: (node: any) => node is Node;

                                                      function isPseudo

                                                      isPseudo: (node: any) => node is Pseudo;
                                                      • Checks whether the node is the Pseudo subtype of node.

                                                      function isPseudoClass

                                                      isPseudoClass: (node: any) => node is Pseudo;
                                                      • Checks whether the node is, specifically, a pseudo class instead of pseudo element.

                                                      function isPseudoElement

                                                      isPseudoElement: (node: any) => node is Pseudo;
                                                      • Checks whether the node is, specifically, a pseudo element instead of pseudo class.

                                                      function isRoot

                                                      isRoot: (node: any) => node is Root;

                                                        function isSelector

                                                        isSelector: (node: any) => node is Selector;

                                                          function isString

                                                          isString: (node: any) => node is String;

                                                            function isTag

                                                            isTag: (node: any) => node is Tag;

                                                              function isUniversal

                                                              isUniversal: (node: any) => node is Universal;

                                                                function nesting

                                                                nesting: (opts: any) => any;

                                                                  function parser

                                                                  parser: typeof parser;

                                                                    function pseudo

                                                                    pseudo: (opts: ContainerOptions) => Pseudo;

                                                                      function root

                                                                      root: (opts: ContainerOptions) => Root;

                                                                        function selector

                                                                        selector: (opts: ContainerOptions) => Selector;

                                                                          function string

                                                                          string: (opts: NodeOptions) => String;

                                                                            function tag

                                                                            tag: (opts: NamespaceOptions) => Tag;

                                                                              function universal

                                                                              universal: (opts?: NamespaceOptions) => any;

                                                                                Classes

                                                                                class Parser

                                                                                class Parser {}

                                                                                  constructor

                                                                                  constructor(input: ParserOptions);

                                                                                    property current

                                                                                    current: Selector;

                                                                                      property input

                                                                                      input: ParserOptions;

                                                                                        property lossy

                                                                                        lossy: boolean;

                                                                                          property position

                                                                                          position: number;

                                                                                            property root

                                                                                            root: Root;

                                                                                              property selectors

                                                                                              selectors: globalThis.String;

                                                                                                method error

                                                                                                error: (message: string, options?: ErrorOptions) => void;
                                                                                                • Raises an error, if the processor is invoked on a postcss Rule node, a better error message is raised.

                                                                                                class Processor

                                                                                                class Processor<
                                                                                                TransformType = never,
                                                                                                SyncSelectorsType extends Selectors | never = Selectors
                                                                                                > {}

                                                                                                  property res

                                                                                                  res: Root;

                                                                                                    property result

                                                                                                    readonly result: string;

                                                                                                      method ast

                                                                                                      ast: (selectors: Selectors, options?: Partial<Options>) => Promise<Root>;

                                                                                                        method astSync

                                                                                                        astSync: (selectors: SyncSelectorsType, options?: Partial<Options>) => Root;

                                                                                                          method process

                                                                                                          process: (selectors: Selectors, options?: Partial<Options>) => Promise<string>;

                                                                                                            method processSync

                                                                                                            processSync: (
                                                                                                            selectors: SyncSelectorsType,
                                                                                                            options?: Partial<Options>
                                                                                                            ) => string;

                                                                                                              method transform

                                                                                                              transform: (
                                                                                                              selectors: Selectors,
                                                                                                              options?: Partial<Options>
                                                                                                              ) => Promise<TransformType>;

                                                                                                                method transformSync

                                                                                                                transformSync: (
                                                                                                                selectors: SyncSelectorsType,
                                                                                                                options?: Partial<Options>
                                                                                                                ) => TransformType;

                                                                                                                  Interfaces

                                                                                                                  interface Attribute

                                                                                                                  interface Attribute extends Namespace<string | undefined> {}

                                                                                                                    property attribute

                                                                                                                    attribute: string;

                                                                                                                      property insensitive

                                                                                                                      insensitive?: boolean;

                                                                                                                        property insensitiveFlag

                                                                                                                        readonly insensitiveFlag: 'i' | '';
                                                                                                                        • The case insensitivity flag or an empty string depending on whether this attribute is case insensitive.

                                                                                                                        property operator

                                                                                                                        operator?: AttributeOperator;

                                                                                                                          property qualifiedAttribute

                                                                                                                          readonly qualifiedAttribute: string;
                                                                                                                          • The attribute name after having been qualified with a namespace.

                                                                                                                          property quoted

                                                                                                                          quoted?: boolean;

                                                                                                                            property quoteMark

                                                                                                                            quoteMark: QuoteMark;

                                                                                                                              property raws

                                                                                                                              raws: {
                                                                                                                              /** @deprecated The attribute value is unquoted, use that instead.. */
                                                                                                                              unquoted?: string;
                                                                                                                              attribute?: string;
                                                                                                                              operator?: string;
                                                                                                                              /** The value of the attribute with quotes and escapes. */
                                                                                                                              value?: string;
                                                                                                                              insensitive?: string;
                                                                                                                              spaces?: {
                                                                                                                              attribute?: Partial<Spaces>;
                                                                                                                              operator?: Partial<Spaces>;
                                                                                                                              value?: Partial<Spaces>;
                                                                                                                              insensitive?: Partial<Spaces>;
                                                                                                                              };
                                                                                                                              };

                                                                                                                                property spaces

                                                                                                                                spaces: {
                                                                                                                                before: string;
                                                                                                                                after: string;
                                                                                                                                attribute?: Partial<Spaces>;
                                                                                                                                operator?: Partial<Spaces>;
                                                                                                                                value?: Partial<Spaces>;
                                                                                                                                insensitive?: Partial<Spaces>;
                                                                                                                                };

                                                                                                                                  property type

                                                                                                                                  type: 'attribute';

                                                                                                                                    method getQuotedValue

                                                                                                                                    getQuotedValue: (options?: SmartQuoteMarkOptions) => string;
                                                                                                                                    • Returns the attribute's value quoted such that it would be legal to use in the value of a css file. The original value's quotation setting used for stringification is left unchanged. See setValue(value, options) if you want to control the quote settings of a new value for the attribute or set quoteMark(mark) if you want to change the quote settings of the current value.

                                                                                                                                      You can also change the quotation used for the current value by setting quoteMark.

                                                                                                                                    method offsetOf

                                                                                                                                    offsetOf: (
                                                                                                                                    part:
                                                                                                                                    | 'ns'
                                                                                                                                    | 'namespace'
                                                                                                                                    | 'attribute'
                                                                                                                                    | 'attributeNS'
                                                                                                                                    | 'operator'
                                                                                                                                    | 'value'
                                                                                                                                    | 'insensitive'
                                                                                                                                    ) => number;
                                                                                                                                    • returns the offset of the attribute part specified relative to the start of the node of the output string.

                                                                                                                                      * "ns" - alias for "namespace" * "namespace" - the namespace if it exists. * "attribute" - the attribute name * "attributeNS" - the start of the attribute or its namespace * "operator" - the match operator of the attribute * "value" - The value (string or identifier) * "insensitive" - the case insensitivity flag;

                                                                                                                                      Parameter part

                                                                                                                                      One of the possible values inside an attribute.

                                                                                                                                      Returns

                                                                                                                                      -1 if the name is invalid or the value doesn't exist in this attribute.

                                                                                                                                    method preferredQuoteMark

                                                                                                                                    preferredQuoteMark: (options: PreferredQuoteMarkOptions) => QuoteMark;
                                                                                                                                    • Selects the preferred quote mark based on the options and the current quote mark value. If you want the quote mark to depend on the attribute value, call smartQuoteMark(opts) instead.

                                                                                                                                    method setValue

                                                                                                                                    setValue: (value: string, options?: SmartQuoteMarkOptions) => void;
                                                                                                                                    • Set the unescaped value with the specified quotation options. The value provided must not include any wrapping quote marks -- those quotes will be interpreted as part of the value and escaped accordingly.

                                                                                                                                      Parameter value

                                                                                                                                    method smartQuoteMark

                                                                                                                                    smartQuoteMark: (options: PreferredQuoteMarkOptions) => QuoteMark;
                                                                                                                                    • Intelligently select a quoteMark value based on the value's contents. If the value is a legal CSS ident, it will not be quoted. Otherwise a quote mark will be picked that minimizes the number of escapes.

                                                                                                                                      If there's no clear winner, the quote mark from these options is used, then the source quote mark (this is inverted if preferCurrentQuoteMark is true). If the quoteMark is unspecified, a double quote is used.

                                                                                                                                    interface AttributeOptions

                                                                                                                                    interface AttributeOptions extends NamespaceOptions<string | undefined> {}

                                                                                                                                      property attribute

                                                                                                                                      attribute: string;

                                                                                                                                        property insensitive

                                                                                                                                        insensitive?: boolean;

                                                                                                                                          property operator

                                                                                                                                          operator?: AttributeOperator;

                                                                                                                                            property quoted

                                                                                                                                            quoted?: boolean;
                                                                                                                                            • Deprecated

                                                                                                                                              Use quoteMark instead.

                                                                                                                                            property quoteMark

                                                                                                                                            quoteMark?: QuoteMark;

                                                                                                                                              property raws

                                                                                                                                              raws: {
                                                                                                                                              unquoted?: string;
                                                                                                                                              attribute?: string;
                                                                                                                                              operator?: string;
                                                                                                                                              value?: string;
                                                                                                                                              insensitive?: string;
                                                                                                                                              spaces?: {
                                                                                                                                              attribute?: Partial<Spaces>;
                                                                                                                                              operator?: Partial<Spaces>;
                                                                                                                                              value?: Partial<Spaces>;
                                                                                                                                              insensitive?: Partial<Spaces>;
                                                                                                                                              };
                                                                                                                                              };

                                                                                                                                                property spaces

                                                                                                                                                spaces?: {
                                                                                                                                                before?: string;
                                                                                                                                                after?: string;
                                                                                                                                                attribute?: Partial<SpaceAround>;
                                                                                                                                                operator?: Partial<SpaceAround>;
                                                                                                                                                value?: Partial<SpaceAround>;
                                                                                                                                                insensitive?: Partial<SpaceAround>;
                                                                                                                                                };

                                                                                                                                                  interface Base

                                                                                                                                                  interface Base<
                                                                                                                                                  Value extends string | undefined = string,
                                                                                                                                                  ParentType extends Container | undefined = Container | undefined
                                                                                                                                                  > {}

                                                                                                                                                    property parent

                                                                                                                                                    parent: ParentType;

                                                                                                                                                      property rawSpaceAfter

                                                                                                                                                      rawSpaceAfter: string;

                                                                                                                                                        property rawSpaceBefore

                                                                                                                                                        rawSpaceBefore: string;

                                                                                                                                                          property source

                                                                                                                                                          source?: NodeSource;

                                                                                                                                                            property sourceIndex

                                                                                                                                                            sourceIndex: number;

                                                                                                                                                              property spaces

                                                                                                                                                              spaces: Spaces;

                                                                                                                                                                property type

                                                                                                                                                                type: keyof NodeTypes;

                                                                                                                                                                  property value

                                                                                                                                                                  value: Value;

                                                                                                                                                                    method appendToPropertyAndEscape

                                                                                                                                                                    appendToPropertyAndEscape: (
                                                                                                                                                                    name: string,
                                                                                                                                                                    value: any,
                                                                                                                                                                    valueEscaped: string
                                                                                                                                                                    ) => void;
                                                                                                                                                                    • Some non-standard syntax doesn't follow normal escaping rules for css. This allows non standard syntax to be appended to an existing property by specifying the escaped value. By specifying the escaped value, illegal characters are allowed to be directly inserted into css output.

                                                                                                                                                                      Parameter name

                                                                                                                                                                      the property to set

                                                                                                                                                                      Parameter value

                                                                                                                                                                      the unescaped value of the property

                                                                                                                                                                      Parameter valueEscaped

                                                                                                                                                                      optional. the escaped value of the property.

                                                                                                                                                                    method clone

                                                                                                                                                                    clone: (opts?: { [override: string]: any }) => this;

                                                                                                                                                                      method isAtPosition

                                                                                                                                                                      isAtPosition: (line: number, column: number) => boolean | undefined;
                                                                                                                                                                      • Return whether this node includes the character at the position of the given line and column. Returns undefined if the nodes lack sufficient source metadata to determine the position.

                                                                                                                                                                        Parameter line

                                                                                                                                                                        1-index based line number relative to the start of the selector.

                                                                                                                                                                        Parameter column

                                                                                                                                                                        1-index based column number relative to the start of the selector.

                                                                                                                                                                      method next

                                                                                                                                                                      next: () => Node | undefined;

                                                                                                                                                                        method prev

                                                                                                                                                                        prev: () => Node | undefined;

                                                                                                                                                                          method remove

                                                                                                                                                                          remove: () => Node;

                                                                                                                                                                            method replaceWith

                                                                                                                                                                            replaceWith: (...nodes: Node[]) => Node;

                                                                                                                                                                              method setPropertyAndEscape

                                                                                                                                                                              setPropertyAndEscape: (name: string, value: any, valueEscaped: string) => void;
                                                                                                                                                                              • Some non-standard syntax doesn't follow normal escaping rules for css, this allows the escaped value to be specified directly, allowing illegal characters to be directly inserted into css output.

                                                                                                                                                                                Parameter name

                                                                                                                                                                                the property to set

                                                                                                                                                                                Parameter value

                                                                                                                                                                                the unescaped value of the property

                                                                                                                                                                                Parameter valueEscaped

                                                                                                                                                                                optional. the escaped value of the property.

                                                                                                                                                                              method setPropertyWithoutEscape

                                                                                                                                                                              setPropertyWithoutEscape: (name: string, value: any) => void;
                                                                                                                                                                              • When you want a value to passed through to CSS directly. This method deletes the corresponding raw value causing the stringifier to fallback to the unescaped value.

                                                                                                                                                                                Parameter name

                                                                                                                                                                                the property to set.

                                                                                                                                                                                Parameter value

                                                                                                                                                                                The value that is both escaped and unescaped.

                                                                                                                                                                              method toString

                                                                                                                                                                              toString: () => string;

                                                                                                                                                                                interface ClassName

                                                                                                                                                                                interface ClassName extends Base {}

                                                                                                                                                                                  property type

                                                                                                                                                                                  type: 'class';

                                                                                                                                                                                    interface Combinator

                                                                                                                                                                                    interface Combinator extends Base {}

                                                                                                                                                                                      property raws

                                                                                                                                                                                      raws?: CombinatorRaws;

                                                                                                                                                                                        property type

                                                                                                                                                                                        type: 'combinator';

                                                                                                                                                                                          interface CombinatorRaws

                                                                                                                                                                                          interface CombinatorRaws {}

                                                                                                                                                                                            property spaces

                                                                                                                                                                                            spaces?: {
                                                                                                                                                                                            before?: string;
                                                                                                                                                                                            after?: string;
                                                                                                                                                                                            };

                                                                                                                                                                                              property value

                                                                                                                                                                                              value?: string;

                                                                                                                                                                                                interface Comment

                                                                                                                                                                                                interface Comment extends Base {}

                                                                                                                                                                                                  property type

                                                                                                                                                                                                  type: 'comment';

                                                                                                                                                                                                    interface Container

                                                                                                                                                                                                    interface Container<
                                                                                                                                                                                                    Value extends string | undefined = string,
                                                                                                                                                                                                    Child extends Node = Node
                                                                                                                                                                                                    > extends Base<Value> {}

                                                                                                                                                                                                      property first

                                                                                                                                                                                                      readonly first: Child;

                                                                                                                                                                                                        property last

                                                                                                                                                                                                        readonly last: Child;

                                                                                                                                                                                                          property length

                                                                                                                                                                                                          readonly length: number;

                                                                                                                                                                                                            property nodes

                                                                                                                                                                                                            nodes: Array<Child>;

                                                                                                                                                                                                              method append

                                                                                                                                                                                                              append: (selector: Child) => this;

                                                                                                                                                                                                                method at

                                                                                                                                                                                                                at: (index: number) => Child;

                                                                                                                                                                                                                  method atPosition

                                                                                                                                                                                                                  atPosition: (line: number, column: number) => Child;
                                                                                                                                                                                                                  • Return the most specific node at the line and column number given. The source location is based on the original parsed location, locations aren't updated as selector nodes are mutated.

                                                                                                                                                                                                                    Note that this location is relative to the location of the first character of the selector, and not the location of the selector in the overall document when used in conjunction with postcss.

                                                                                                                                                                                                                    If not found, returns undefined.

                                                                                                                                                                                                                    Parameter line

                                                                                                                                                                                                                    The line number of the node to find. (1-based index)

                                                                                                                                                                                                                    Parameter col

                                                                                                                                                                                                                    The column number of the node to find. (1-based index)

                                                                                                                                                                                                                  method each

                                                                                                                                                                                                                  each: (
                                                                                                                                                                                                                  callback: (node: Child, index: number) => boolean | void
                                                                                                                                                                                                                  ) => boolean | undefined;

                                                                                                                                                                                                                    method empty

                                                                                                                                                                                                                    empty: () => this;

                                                                                                                                                                                                                      method every

                                                                                                                                                                                                                      every: (callback: (node: Child) => boolean) => boolean;

                                                                                                                                                                                                                        method filter

                                                                                                                                                                                                                        filter: (callback: (node: Child) => boolean) => Child[];

                                                                                                                                                                                                                          method index

                                                                                                                                                                                                                          index: (child: Child) => number;

                                                                                                                                                                                                                            method insertAfter

                                                                                                                                                                                                                            insertAfter: (oldNode: Child, newNode: Child) => this;

                                                                                                                                                                                                                              method insertBefore

                                                                                                                                                                                                                              insertBefore: (oldNode: Child, newNode: Child) => this;

                                                                                                                                                                                                                                method map

                                                                                                                                                                                                                                map: <T>(callback: (node: Child) => T) => T[];

                                                                                                                                                                                                                                  method prepend

                                                                                                                                                                                                                                  prepend: (selector: Child) => this;

                                                                                                                                                                                                                                    method reduce

                                                                                                                                                                                                                                    reduce: {
                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                    callback: (
                                                                                                                                                                                                                                    previousValue: Child,
                                                                                                                                                                                                                                    currentValue: Child,
                                                                                                                                                                                                                                    currentIndex: number,
                                                                                                                                                                                                                                    array: readonly Child[]
                                                                                                                                                                                                                                    ) => Child
                                                                                                                                                                                                                                    ): Child;
                                                                                                                                                                                                                                    (
                                                                                                                                                                                                                                    callback: (
                                                                                                                                                                                                                                    previousValue: Child,
                                                                                                                                                                                                                                    currentValue: Child,
                                                                                                                                                                                                                                    currentIndex: number,
                                                                                                                                                                                                                                    array: readonly Child[]
                                                                                                                                                                                                                                    ) => Child,
                                                                                                                                                                                                                                    initialValue: Child
                                                                                                                                                                                                                                    ): Child;
                                                                                                                                                                                                                                    <T>(
                                                                                                                                                                                                                                    callback: (
                                                                                                                                                                                                                                    previousValue: T,
                                                                                                                                                                                                                                    currentValue: Child,
                                                                                                                                                                                                                                    currentIndex: number,
                                                                                                                                                                                                                                    array: readonly Child[]
                                                                                                                                                                                                                                    ) => T,
                                                                                                                                                                                                                                    initialValue: T
                                                                                                                                                                                                                                    ): T;
                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                      method removeAll

                                                                                                                                                                                                                                      removeAll: () => this;

                                                                                                                                                                                                                                        method removeChild

                                                                                                                                                                                                                                        removeChild: (child: Child) => this;

                                                                                                                                                                                                                                          method some

                                                                                                                                                                                                                                          some: (callback: (node: Child) => boolean) => boolean;

                                                                                                                                                                                                                                            method sort

                                                                                                                                                                                                                                            sort: (callback: (nodeA: Child, nodeB: Child) => number) => Child[];

                                                                                                                                                                                                                                              method split

                                                                                                                                                                                                                                              split: (callback: (node: Child) => boolean) => [Child[], Child[]];

                                                                                                                                                                                                                                                method toString

                                                                                                                                                                                                                                                toString: () => string;

                                                                                                                                                                                                                                                  method walk

                                                                                                                                                                                                                                                  walk: (
                                                                                                                                                                                                                                                  callback: (node: Node, index: number) => boolean | void
                                                                                                                                                                                                                                                  ) => boolean | undefined;

                                                                                                                                                                                                                                                    method walkAttributes

                                                                                                                                                                                                                                                    walkAttributes: (
                                                                                                                                                                                                                                                    callback: (node: Attribute) => boolean | void
                                                                                                                                                                                                                                                    ) => boolean | undefined;

                                                                                                                                                                                                                                                      method walkClasses

                                                                                                                                                                                                                                                      walkClasses: (
                                                                                                                                                                                                                                                      callback: (node: ClassName) => boolean | void
                                                                                                                                                                                                                                                      ) => boolean | undefined;

                                                                                                                                                                                                                                                        method walkCombinators

                                                                                                                                                                                                                                                        walkCombinators: (
                                                                                                                                                                                                                                                        callback: (node: Combinator) => boolean | void
                                                                                                                                                                                                                                                        ) => boolean | undefined;

                                                                                                                                                                                                                                                          method walkComments

                                                                                                                                                                                                                                                          walkComments: (
                                                                                                                                                                                                                                                          callback: (node: Comment) => boolean | void
                                                                                                                                                                                                                                                          ) => boolean | undefined;

                                                                                                                                                                                                                                                            method walkIds

                                                                                                                                                                                                                                                            walkIds: (callback: (node: Identifier) => boolean | void) => boolean | undefined;

                                                                                                                                                                                                                                                              method walkNesting

                                                                                                                                                                                                                                                              walkNesting: (
                                                                                                                                                                                                                                                              callback: (node: Nesting) => boolean | void
                                                                                                                                                                                                                                                              ) => boolean | undefined;

                                                                                                                                                                                                                                                                method walkPseudos

                                                                                                                                                                                                                                                                walkPseudos: (callback: (node: Pseudo) => boolean | void) => boolean | undefined;

                                                                                                                                                                                                                                                                  method walkTags

                                                                                                                                                                                                                                                                  walkTags: (callback: (node: Tag) => boolean | void) => boolean | undefined;

                                                                                                                                                                                                                                                                    interface ContainerOptions

                                                                                                                                                                                                                                                                    interface ContainerOptions extends NodeOptions {}

                                                                                                                                                                                                                                                                      property nodes

                                                                                                                                                                                                                                                                      nodes?: Array<Node>;

                                                                                                                                                                                                                                                                        interface Identifier

                                                                                                                                                                                                                                                                        interface Identifier extends Base {}

                                                                                                                                                                                                                                                                          property type

                                                                                                                                                                                                                                                                          type: 'id';

                                                                                                                                                                                                                                                                            interface Namespace

                                                                                                                                                                                                                                                                            interface Namespace<Value extends string | undefined = string> extends Base<Value> {}

                                                                                                                                                                                                                                                                              property namespace

                                                                                                                                                                                                                                                                              namespace: string | true;
                                                                                                                                                                                                                                                                              • namespace prefix.

                                                                                                                                                                                                                                                                              property namespaceString

                                                                                                                                                                                                                                                                              readonly namespaceString: string;
                                                                                                                                                                                                                                                                              • A string representing the namespace suitable for output.

                                                                                                                                                                                                                                                                              property ns

                                                                                                                                                                                                                                                                              ns: string | true;
                                                                                                                                                                                                                                                                              • alias for namespace

                                                                                                                                                                                                                                                                              method qualifiedName

                                                                                                                                                                                                                                                                              qualifiedName: (value: string) => string;
                                                                                                                                                                                                                                                                              • If a namespace exists, prefix the value provided with it, separated by |.

                                                                                                                                                                                                                                                                              interface NamespaceOptions

                                                                                                                                                                                                                                                                              interface NamespaceOptions<Value extends string | undefined = string>
                                                                                                                                                                                                                                                                              extends NodeOptions<Value> {}

                                                                                                                                                                                                                                                                                property namespace

                                                                                                                                                                                                                                                                                namespace?: string | true;

                                                                                                                                                                                                                                                                                  interface Nesting

                                                                                                                                                                                                                                                                                  interface Nesting extends Base {}

                                                                                                                                                                                                                                                                                    property type

                                                                                                                                                                                                                                                                                    type: 'nesting';

                                                                                                                                                                                                                                                                                      interface NodeOptions

                                                                                                                                                                                                                                                                                      interface NodeOptions<Value = string> {}

                                                                                                                                                                                                                                                                                        property source

                                                                                                                                                                                                                                                                                        source?: NodeSource;

                                                                                                                                                                                                                                                                                          property sourceIndex

                                                                                                                                                                                                                                                                                          sourceIndex?: number;

                                                                                                                                                                                                                                                                                            property spaces

                                                                                                                                                                                                                                                                                            spaces?: Partial<Spaces>;

                                                                                                                                                                                                                                                                                              property value

                                                                                                                                                                                                                                                                                              value: Value;

                                                                                                                                                                                                                                                                                                interface NodeSource

                                                                                                                                                                                                                                                                                                interface NodeSource {}

                                                                                                                                                                                                                                                                                                  property end

                                                                                                                                                                                                                                                                                                  end?: {
                                                                                                                                                                                                                                                                                                  line: number;
                                                                                                                                                                                                                                                                                                  column: number;
                                                                                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                                                                                    property start

                                                                                                                                                                                                                                                                                                    start?: {
                                                                                                                                                                                                                                                                                                    line: number;
                                                                                                                                                                                                                                                                                                    column: number;
                                                                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                                                                      interface NodeTypes

                                                                                                                                                                                                                                                                                                      interface NodeTypes {}

                                                                                                                                                                                                                                                                                                        property attribute

                                                                                                                                                                                                                                                                                                        attribute: Attribute;

                                                                                                                                                                                                                                                                                                          property class

                                                                                                                                                                                                                                                                                                          class: ClassName;

                                                                                                                                                                                                                                                                                                            property combinator

                                                                                                                                                                                                                                                                                                            combinator: Combinator;

                                                                                                                                                                                                                                                                                                              property comment

                                                                                                                                                                                                                                                                                                              comment: Comment;

                                                                                                                                                                                                                                                                                                                property id

                                                                                                                                                                                                                                                                                                                id: Identifier;

                                                                                                                                                                                                                                                                                                                  property nesting

                                                                                                                                                                                                                                                                                                                  nesting: Nesting;

                                                                                                                                                                                                                                                                                                                    property pseudo

                                                                                                                                                                                                                                                                                                                    pseudo: Pseudo;

                                                                                                                                                                                                                                                                                                                      property root

                                                                                                                                                                                                                                                                                                                      root: Root;

                                                                                                                                                                                                                                                                                                                        property selector

                                                                                                                                                                                                                                                                                                                        selector: Selector;

                                                                                                                                                                                                                                                                                                                          property string

                                                                                                                                                                                                                                                                                                                          string: String;

                                                                                                                                                                                                                                                                                                                            property tag

                                                                                                                                                                                                                                                                                                                            tag: Tag;

                                                                                                                                                                                                                                                                                                                              property universal

                                                                                                                                                                                                                                                                                                                              universal: Universal;

                                                                                                                                                                                                                                                                                                                                interface Options

                                                                                                                                                                                                                                                                                                                                interface Options {}

                                                                                                                                                                                                                                                                                                                                  property lossless

                                                                                                                                                                                                                                                                                                                                  lossless: boolean;
                                                                                                                                                                                                                                                                                                                                  • Preserve whitespace when true. Default: false;

                                                                                                                                                                                                                                                                                                                                  property updateSelector

                                                                                                                                                                                                                                                                                                                                  updateSelector: boolean;
                                                                                                                                                                                                                                                                                                                                  • When true and a postcss.Rule is passed, set the result of processing back onto the rule when done. Default: false.

                                                                                                                                                                                                                                                                                                                                  interface ParserOptions

                                                                                                                                                                                                                                                                                                                                  interface ParserOptions {}

                                                                                                                                                                                                                                                                                                                                    property css

                                                                                                                                                                                                                                                                                                                                    css: string;

                                                                                                                                                                                                                                                                                                                                      property error

                                                                                                                                                                                                                                                                                                                                      error: (message: string, options: ErrorOptions) => Error;

                                                                                                                                                                                                                                                                                                                                        property options

                                                                                                                                                                                                                                                                                                                                        options: Options;

                                                                                                                                                                                                                                                                                                                                          interface PreferredQuoteMarkOptions

                                                                                                                                                                                                                                                                                                                                          interface PreferredQuoteMarkOptions {}

                                                                                                                                                                                                                                                                                                                                            property preferCurrentQuoteMark

                                                                                                                                                                                                                                                                                                                                            preferCurrentQuoteMark?: boolean;

                                                                                                                                                                                                                                                                                                                                              property quoteMark

                                                                                                                                                                                                                                                                                                                                              quoteMark?: QuoteMark;

                                                                                                                                                                                                                                                                                                                                                interface Pseudo

                                                                                                                                                                                                                                                                                                                                                interface Pseudo extends Container<string, Selector> {}

                                                                                                                                                                                                                                                                                                                                                  property type

                                                                                                                                                                                                                                                                                                                                                  type: 'pseudo';

                                                                                                                                                                                                                                                                                                                                                    interface Root

                                                                                                                                                                                                                                                                                                                                                    interface Root extends Container<undefined, Selector> {}

                                                                                                                                                                                                                                                                                                                                                      property type

                                                                                                                                                                                                                                                                                                                                                      type: 'root';

                                                                                                                                                                                                                                                                                                                                                        method error

                                                                                                                                                                                                                                                                                                                                                        error: (message: string, options?: ErrorOptions) => Error;
                                                                                                                                                                                                                                                                                                                                                        • Raises an error, if the processor is invoked on a postcss Rule node, a better error message is raised.

                                                                                                                                                                                                                                                                                                                                                        method nodeAt

                                                                                                                                                                                                                                                                                                                                                        nodeAt: (line: number, column: number) => Node;

                                                                                                                                                                                                                                                                                                                                                          interface SmartQuoteMarkOptions

                                                                                                                                                                                                                                                                                                                                                          interface SmartQuoteMarkOptions extends PreferredQuoteMarkOptions {}

                                                                                                                                                                                                                                                                                                                                                            property smart

                                                                                                                                                                                                                                                                                                                                                            smart?: boolean;

                                                                                                                                                                                                                                                                                                                                                              interface SpaceAround

                                                                                                                                                                                                                                                                                                                                                              interface SpaceAround {}

                                                                                                                                                                                                                                                                                                                                                                property after

                                                                                                                                                                                                                                                                                                                                                                after: string;

                                                                                                                                                                                                                                                                                                                                                                  property before

                                                                                                                                                                                                                                                                                                                                                                  before: string;

                                                                                                                                                                                                                                                                                                                                                                    interface Spaces

                                                                                                                                                                                                                                                                                                                                                                    interface Spaces extends SpaceAround {}

                                                                                                                                                                                                                                                                                                                                                                      index signature

                                                                                                                                                                                                                                                                                                                                                                      [spaceType: string]: string | Partial<SpaceAround> | undefined;

                                                                                                                                                                                                                                                                                                                                                                        interface String

                                                                                                                                                                                                                                                                                                                                                                        interface String extends Base {}

                                                                                                                                                                                                                                                                                                                                                                          property type

                                                                                                                                                                                                                                                                                                                                                                          type: 'string';

                                                                                                                                                                                                                                                                                                                                                                            interface Tag

                                                                                                                                                                                                                                                                                                                                                                            interface Tag extends Namespace {}

                                                                                                                                                                                                                                                                                                                                                                              property type

                                                                                                                                                                                                                                                                                                                                                                              type: 'tag';

                                                                                                                                                                                                                                                                                                                                                                                interface Universal

                                                                                                                                                                                                                                                                                                                                                                                interface Universal extends Base {}

                                                                                                                                                                                                                                                                                                                                                                                  property type

                                                                                                                                                                                                                                                                                                                                                                                  type: 'universal';

                                                                                                                                                                                                                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                                                                                                                                                                                                                    type AsyncProcessor

                                                                                                                                                                                                                                                                                                                                                                                    type AsyncProcessor<Transform = void> = ProcessorFn<PromiseLike<Transform>>;

                                                                                                                                                                                                                                                                                                                                                                                      type AttributeOperator

                                                                                                                                                                                                                                                                                                                                                                                      type AttributeOperator = '=' | '~=' | '|=' | '^=' | '$=' | '*=';

                                                                                                                                                                                                                                                                                                                                                                                        type ErrorOptions

                                                                                                                                                                                                                                                                                                                                                                                        type ErrorOptions = {
                                                                                                                                                                                                                                                                                                                                                                                        plugin?: string;
                                                                                                                                                                                                                                                                                                                                                                                        word?: string;
                                                                                                                                                                                                                                                                                                                                                                                        index?: number;
                                                                                                                                                                                                                                                                                                                                                                                        };

                                                                                                                                                                                                                                                                                                                                                                                          type Node

                                                                                                                                                                                                                                                                                                                                                                                          type Node = NodeTypes[keyof NodeTypes];

                                                                                                                                                                                                                                                                                                                                                                                            type PostCSSRuleNode

                                                                                                                                                                                                                                                                                                                                                                                            type PostCSSRuleNode = {
                                                                                                                                                                                                                                                                                                                                                                                            selector: string;
                                                                                                                                                                                                                                                                                                                                                                                            /**
                                                                                                                                                                                                                                                                                                                                                                                            * @returns postcss.CssSyntaxError but it's a complex object, caller
                                                                                                                                                                                                                                                                                                                                                                                            * should cast to it if they have a dependency on postcss.
                                                                                                                                                                                                                                                                                                                                                                                            */
                                                                                                                                                                                                                                                                                                                                                                                            error(message: string, options?: ErrorOptions): Error;
                                                                                                                                                                                                                                                                                                                                                                                            };

                                                                                                                                                                                                                                                                                                                                                                                              type ProcessorFn

                                                                                                                                                                                                                                                                                                                                                                                              type ProcessorFn<ReturnType = void> = (root: parser.Root) => ReturnType;

                                                                                                                                                                                                                                                                                                                                                                                                type QuoteMark

                                                                                                                                                                                                                                                                                                                                                                                                type QuoteMark = '"' | "'" | null;

                                                                                                                                                                                                                                                                                                                                                                                                  type Selector

                                                                                                                                                                                                                                                                                                                                                                                                  type Selector = _Selector<Selector>;

                                                                                                                                                                                                                                                                                                                                                                                                    type Selectors

                                                                                                                                                                                                                                                                                                                                                                                                    type Selectors = string | PostCSSRuleNode;
                                                                                                                                                                                                                                                                                                                                                                                                    • Accepts a string

                                                                                                                                                                                                                                                                                                                                                                                                    type SyncProcessor

                                                                                                                                                                                                                                                                                                                                                                                                    type SyncProcessor<Transform = void> = ProcessorFn<Transform>;

                                                                                                                                                                                                                                                                                                                                                                                                      Package Files (1)

                                                                                                                                                                                                                                                                                                                                                                                                      Dependencies (2)

                                                                                                                                                                                                                                                                                                                                                                                                      Dev Dependencies (19)

                                                                                                                                                                                                                                                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                                                      No peer dependencies.

                                                                                                                                                                                                                                                                                                                                                                                                      Badge

                                                                                                                                                                                                                                                                                                                                                                                                      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/postcss-selector-parser.

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