CssParserToken Struct

The CSSToken typedef: (DOMString or CSSStyleValue or CSSParserValue) (https://wicg.github.io/css-parser-api/#typedefdef-csstoken), a component value (https://drafts.csswg.org/css-syntax-3/#component-value) of the results of the CSS Parser API. The parser represents an ident token as a CssKeywordValue, a number, a percentage or a dimension token whose unit is a CSS unit as a CssUnitValue, a function as a CssParserFunction, a simple block as a CssParserBlock, a whitespace token as " ", and the other tokens as their text (e.g. ",", "#fff", "\"text\"", "10foo").

public readonly struct CssParserToken : IEquatable<CssParserToken>
Implements

Properties

NameDescription
ParserValueGets the token as a CssParserValue (a function or a block), or null.
StringValueGets the token as a string, or null when it is an object.
StyleValueGets the token as a CssStyleValue, or null.
ValueGets the value: a String, a CssStyleValue or a CssParserValue.

Gets the token as a CssParserValue (a function or a block), or null.

public CssParserValue? ParserValue { get; }

Property value

CssParserValue?

Gets the token as a string, or null when it is an object.

public string? StringValue { get; }

Property value

string?

Gets the token as a CssStyleValue, or null.

public CssStyleValue? StyleValue { get; }

Property value

CssStyleValue?

Gets the value: a String, a CssStyleValue or a CssParserValue.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(CssParserToken)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromCssParserValue(CssParserValue)Creates a CssParserToken from a CssParserValue.
FromCssStyleValue(CssStyleValue)Creates a CssParserToken from a CssStyleValue.
FromString(string)Creates a CssParserToken from a string.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the serialization of the token.

Equals overloads

Equals(CssParserToken)

CssParserObjects.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(CssParserToken other)
Parameters
other CssParserToken
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

CssParserObjects.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromCssParserValue(CssParserValue)

CssParserObjects.cs

Creates a CssParserToken from a CssParserValue.

public static CssParserToken FromCssParserValue(CssParserValue value)

Parameters

value CssParserValue

Returns

CssParserToken

FromCssStyleValue(CssStyleValue)

CssParserObjects.cs

Creates a CssParserToken from a CssStyleValue.

public static CssParserToken FromCssStyleValue(CssStyleValue value)

Parameters

value CssStyleValue

Returns

CssParserToken

FromString(string)

CssParserObjects.cs

Creates a CssParserToken from a string.

public static CssParserToken FromString(string value)

Parameters

value string

Returns

CssParserToken

GetHashCode()

CssParserObjects.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Returns the serialization of the token.

public override string ToString()

Returns

string

Operators

NameDescription
operator ==(CssParserToken, CssParserToken)Determines whether two CssParserToken values are equal.
implicit operator CssParserToken(CssParserValue)Converts a CssParserValue to a CssParserToken.
implicit operator CssParserToken(CssStyleValue)Converts a CssStyleValue to a CssParserToken.
implicit operator CssParserToken(string)Converts a string to a CssParserToken.
operator !=(CssParserToken, CssParserToken)Determines whether two CssParserToken values are not equal.

operator ==(CssParserToken, CssParserToken)

CssParserObjects.cs

Determines whether two CssParserToken values are equal.

public static bool operator ==(CssParserToken left, CssParserToken right)

Parameters

left CssParserToken
right CssParserToken

Returns

bool

op_Implicit overloads

implicit operator CssParserToken(CssParserValue)

CssParserObjects.cs

Converts a CssParserValue to a CssParserToken.

public static implicit operator CssParserToken(CssParserValue value)
Parameters
value CssParserValue
Returns

CssParserToken

implicit operator CssParserToken(CssStyleValue)

CssParserObjects.cs

Converts a CssStyleValue to a CssParserToken.

public static implicit operator CssParserToken(CssStyleValue value)
Parameters
value CssStyleValue
Returns

CssParserToken

implicit operator CssParserToken(string)

CssParserObjects.cs

Converts a string to a CssParserToken.

public static implicit operator CssParserToken(string value)
Parameters
value string
Returns

CssParserToken

operator !=(CssParserToken, CssParserToken)

CssParserObjects.cs

Determines whether two CssParserToken values are not equal.

public static bool operator !=(CssParserToken left, CssParserToken right)

Parameters

left CssParserToken
right CssParserToken

Returns

bool