8000 postcss-plugins/packages/css-parser-algorithms/docs/css-parser-algorithms.simpleblocknode.md at 0a8530cfb89b8d6ca0a93a4f7c466ee61e7c0d8a · csstools/postcss-plugins · GitHub
Skip to content

Latest commit

 

History

History
203 lines (92 loc) · 2.69 KB

File metadata and controls

203 lines (92 loc) · 2.69 KB

Home > @csstools/css-parser-algorithms > SimpleBlockNode

SimpleBlockNode class

A simple block node.

Signature:

export declare class SimpleBlockNode extends ContainerNodeBaseClass 

Extends: ContainerNodeBaseClass

Example

const node = parseComponentValue(tokenize('[foo=bar]'));

isSimpleBlockNode(node); // true
node.startToken; // [TokenType.OpenSquare, '[', 0, 0, undefined]

Constructors

Constructor

Modifiers

Description

(constructor)(startToken, endToken, value)

Constructs a new instance of the SimpleBlockNode class

Properties

Property

Modifiers

Type

Description

endToken

CSSToken

The token for the closing token of the block. If the block is closed it will be the mirror variant of the startToken. If the block is unclosed, this will be an EOF token.

startToken

CSSToken

The token for the opening token of the block.

type

ComponentValueType

The node type, always ComponentValueType.SimpleBlock

Methods

Method

Modifiers

Description

normalize()

Normalize the current simple block 1. if the "endToken" is EOF, replace with the mirror token of the "startToken"

tokens()

Retrieve the tokens for the current simple block. This is the inverse of parsing from a list of tokens.

toString()

Convert the current simple block to a string. This is not a true serialization. It is purely a concatenation of the string representation of the tokens.