@@ -330,13 +330,7 @@ export class CSSNode {
330330 return content
331331 }
332332
333- /**
334- * Namespace prefix for type and universal selectors.
335- * - `null` — no namespace qualifier (plain `div` or `*`)
336- * - `''` — empty namespace (`|div` or `|*`)
337- * - `'ns'` — named namespace (`ns|div` or `ns|*`)
338- * - `'*'` — any namespace (`*|div` or `*|*`)
339- */
333+ /** Namespace prefix for type/universal selectors: null (none), '' (`|div`), 'ns' (`ns|div`), or '*' (`*|div`). */
340334 get namespace ( ) : string | null | undefined {
341335 let { type } = this
342336 if ( type !== TYPE_SELECTOR && type !== UNIVERSAL_SELECTOR ) return undefined
@@ -346,22 +340,16 @@ export class CSSNode {
346340 return this . source . substring ( start , start + length )
347341 }
348342
349- /**
350- * Alias for name (for declarations: "color" in "color: blue")
351- * More semantic than `name` for declaration nodes
352- */
343+ /** Alias for `name` on declarations ("color" in "color: blue"), more semantic than `name` there. */
353344 get property ( ) : string | undefined {
354345 let { type } = this
355346 if ( type !== DECLARATION && type !== MEDIA_FEATURE ) return
356347 return this . get_content ( )
357348 }
358349
359350 /**
360- * Get the value text (for declarations: "1px solid blue" in "border: 1px solid blue")
361- * For dimension/number nodes: returns the numeric value as a number
362- * For string nodes: returns the string content without quotes
363- * For URL nodes with quoted string: returns the string with quotes (consistent with STRING node)
364- * For URL nodes with unquoted URL: returns the URL content without quotes
351+ * Declarations: the value text ("1px solid blue"). Dimension/number: the numeric value.
352+ * String: content without quotes. URL: quoted string keeps quotes, unquoted URL doesn't.
365353 */
366354 get value ( ) : CSSNode | string | number | null | undefined {
367355 let { type, text, first_child } = this
@@ -433,12 +421,7 @@ export class CSSNode {
433421 return this . source . substring ( start , start + length )
434422 }
435423
436- /**
437- * Get the prelude node:
438- * - For at-rules: AT_RULE_PRELUDE wrapper containing structured prelude children (media queries, layer names, etc.)
439- * - For style rules: SELECTOR_LIST or SELECTOR node
440- * Returns null if no prelude exists
441- */
424+ /** At-rules: AT_RULE_PRELUDE wrapper (media queries, layer names, …). Style rules: SELECTOR_LIST/SELECTOR. Null if none. */
442425 get prelude ( ) : CSSNode | null | undefined {
443426 if ( this . type === AT_RULE ) {
444427 let first = this . first_child
@@ -454,11 +437,7 @@ export class CSSNode {
454437 return undefined
455438 }
456439
457- /**
458- * Get the attribute operator (for attribute selectors: =, ~=, |=, ^=, $=, *=)
459- * Returns the operator string, or null if no operator is present ([attr] form).
460- * Derived from source text between the attribute name and value.
461- */
440+ /** Attribute selector operator (=, ~=, |=, ^=, $=, *=), or null for the bare `[attr]` form. */
462441 get attr_operator ( ) : string | null | undefined {
463442 if ( this . type !== ATTRIBUTE_SELECTOR ) return undefined
464443
@@ -485,11 +464,7 @@ export class CSSNode {
485464 return null
486465 }
487466
488- /**
489- * Get the attribute flags (for attribute selectors: i, s)
490- * Returns "i" (case-insensitive), "s" (case-sensitive), or null if no flag is present.
491- * Derived from source text after the attribute value.
492- */
467+ /** Attribute selector flag: "i" (case-insensitive), "s" (case-sensitive), or null if absent. */
493468 get attr_flags ( ) : string | null | undefined {
494469 if ( this . type !== ATTRIBUTE_SELECTOR ) return undefined
495470
@@ -684,11 +659,7 @@ export class CSSNode {
684659 return sibling_index !== 0
685660 }
686661
687- /**
688- * Check if this node has children
689- * For pseudo-class/pseudo-element functions, returns true if FLAG_HAS_PARENS is set
690- * This allows formatters to distinguish :lang() from :hover
691- */
662+ /** Whether this node has children. For pseudo-class/element functions, tracks FLAG_HAS_PARENS so formatters can tell `:lang()` from `:hover`. */
692663 get has_children ( ) : boolean {
693664 let { type } = this
694665 // For pseudo-class/pseudo-element nodes, check if they have function syntax
@@ -795,13 +766,8 @@ export class CSSNode {
795766 // --- Node Cloning ---
796767
797768 /**
798- * Clone this node as a mutable plain JavaScript object with children as arrays.
799- * See API.md for examples.
800- * Warning: this should be used sparingly because it potentially consumes a lot of memory.
801- *
802- * @param options - Cloning configuration
803- * @param options.deep - Recursively clone children (default: true)
804- * @param options.locations - Include line/column/start/length (default: false)
769+ * Clone this node as a mutable plain object with children as arrays.
770+ * Use sparingly — can consume a lot of memory.
805771 */
806772 clone ( options : CloneOptions = { } ) : PlainCSSNode {
807773 const { deep = true , locations = false } = options
0 commit comments