Appearance
ImmutableCssNode
Union type representing immutable CSS nodes in email templates.
typescript
type ImmutableCssNode = ImmutableCssCommentNode
| ImmutableCssAttributeNode
| ImmutableCssRuleNode
| ImmutableCssDocumentNode;
Description
ImmutableCssNode
is a union type that represents any CSS node in the stylesheet structure. It can be a comment, attribute (property), rule, or document node. This type is used throughout the API for CSS manipulation and querying.
Import
typescript
import { ImmutableCssNode } from '@stripoinc/ui-editor-extensions';
Type Members
Type | Description |
---|---|
ImmutableCssCommentNode | CSS comment nodes |
ImmutableCssAttributeNode | CSS properties within rules |
ImmutableCssRuleNode | CSS rules with selectors |
ImmutableCssDocumentNode | CSS document root or @media blocks |
Base Inheritance
All CSS nodes extend from:
BaseImmutableNode<ImmutableCssNode>
- Common node operationsBaseImmutableCssNode
- CSS-specific base operations
Type Guards and Casting
Determining Node Type
typescript
function processCssNode(node: ImmutableCssNode) {
const type = node.getType();
switch(type) {
case 'rule':
const rule = node.asRule();
console.log(`Rule: ${rule.getSelector()}`);
break;
case 'attr':
const attr = node.asAttribute();
console.log(`Property: ${attr.getAttributeName()}: ${attr.getAttributeValue()}`);
break;
case 'comment':
const comment = node.asComment();
console.log(`Comment: ${comment.getTextContent()}`);
break;
case 'document':
case 'media':
const doc = node.asDocument();
console.log('Document or media query node');
break;
}
}