CssParserDeclaration Class

A declaration (https://wicg.github.io/css-parser-api/#cssparserdeclaration, https://drafts.csswg.org/css-syntax-3/#declaration): a name and a value, e.g. color: red.

public sealed class CssParserDeclaration : CssParserRule
Inheritance
CssParserRule CssParserDeclaration

Constructors

NameDescription
CssParserDeclaration(string, IEnumerable<CssParserToken>?)Creates a declaration (https://wicg.github.io/css-parser-api/#dom-cssparserdeclaration-cssparserdeclaration).

CssParserDeclaration(string, IEnumerable<CssParserToken>?)

CssParserObjects.cs

Creates a declaration (https://wicg.github.io/css-parser-api/#dom-cssparserdeclaration-cssparserdeclaration).

public CssParserDeclaration(string name, IEnumerable<CssParserToken>? body = null)

Parameters

name string
The name of the declaration (e.g. a property name).
body IEnumerable<CssParserToken>?
The component values of the value. The IDL of the draft declares a sequence of rules; as the CssParserDeclaration.Body attribute, it is a list of component values.

See also

Properties

NameDescription
BodyGets the component values of the value, without the leading and trailing whitespace and without !important (https://drafts.csswg.org/css-syntax-3/#consume-declaration).
ImportantGets a value indicating whether the value ended with !important (the important flag of CSS Syntax). The draft has no attribute for it: the scripts see it in the serialization.
NameGets the name of the declaration.

Gets the component values of the value, without the leading and trailing whitespace and without !important (https://drafts.csswg.org/css-syntax-3/#consume-declaration).

public IReadOnlyList<CssParserToken> Body { get; }

Gets a value indicating whether the value ended with !important (the important flag of CSS Syntax). The draft has no attribute for it: the scripts see it in the serialization.

public bool Important { get; init; }

Property value

bool

Gets the name of the declaration.

public string Name { get; }