CssSyntaxNode Class
The base of every node in a CSS tree.
public abstract class CssSyntaxNode : SyntaxNodeExample
var tree = CssSyntaxTree.ParseText("a { color: red }");
var kinds = new List<SyntaxKind>();
foreach (var node in tree.GetRoot().DescendantNodes())
{
kinds.Add(node.Kind());
}
Assert.Equal([SyntaxKind.StyleRule, SyntaxKind.SelectorList, SyntaxKind.ComplexSelector, SyntaxKind.ComplexSelectorPart, SyntaxKind.CompoundSelector, SyntaxKind.TypeSelector, SyntaxKind.Block, SyntaxKind.Declaration, SyntaxKind.TokenValue], kinds);- Inheritance
SyntaxNodeCssSyntaxNode
Properties
| Name | Description |
|---|---|
| Parent | Gets the node this one is a child of, or null when it is the root of its tree. |
Parent
CssSyntaxNode.csGets the node this one is a child of, or null when it is the root of its tree.
public CssSyntaxNode? Parent { get; }Property value
Methods
| Name | Description |
|---|---|
| Accept(CssSyntaxVisitor) | Calls the method of visitor that matches this node. |
| Accept<TResult>(CssSyntaxVisitor<TResult>) | Calls the method of visitor that matches this node. |
| DescendantComments() | Returns every comment in this node, in source order. |
| Kind() | Gets what kind of node this is. |
Accept overloads
Accept(CssSyntaxVisitor)
Calls the method of visitor that matches this node.
public abstract void Accept(CssSyntaxVisitor visitor)Accept<TResult>(CssSyntaxVisitor<TResult>)
Calls the method of visitor that matches this node.
public abstract TResult? Accept<TResult>(CssSyntaxVisitor<TResult> visitor)Type parameters
TResult
Parameters
visitorCssSyntaxVisitor<TResult>
Returns
TResult?
Exceptions
ArgumentNullExceptionvisitorisnull.
DescendantComments()
CssSyntaxNode.csReturns every comment in this node, in source order.
public IEnumerable<SyntaxTrivia> DescendantComments()