/** * Index-based iteration over legacy DOM collections. * * `CSSStyleDeclaration`, `CSSRuleList`, `StyleSheetList`, `NamedNodeMap`, and * `HTMLCollection` are all `length`-plus-`item()` interfaces. Browsers have * retrofitted `Symbol.iterator` onto several of them; JSDOM has not, and which * ones are covered differs by engine and version. * * `for...of` over them therefore works in Chromium and throws in JSDOM — an * engine-dependent crash in the one component whose entire purpose is to behave * identically on both. Everything here goes through these helpers instead. */ interface IndexedCollection { readonly length: number; item?(index: number): T | null; readonly [index: number]: T; } /** * Read a collection by index, preferring `item()` and falling back to bracket * access. * * The fallback is not defensive padding. JSDOM's CSS object model comes from * `cssom`, whose `CSSRuleList` is a bare array-like with a `length` and no * `item` method at all — so a browser-correct `item()` call throws there, while * bracket access works on both. Neither form alone covers both engines. */ export declare function items(collection: IndexedCollection | null | undefined): T[]; /** * Property names of a `CSSStyleDeclaration`. * * Separate from {@link items} because its `item()` returns property *names* * rather than nodes, and because a declaration block with a `length` of 0 is * routine rather than exceptional. */ export declare function propertyNames(style: CSSStyleDeclaration | null | undefined): string[]; /** Elements of an `HTMLCollection`, which has `item()` but not always an iterator. */ export declare function elements(collection: HTMLCollection | null | undefined): Element[]; /** Attributes of an element, as plain name/value pairs. */ export declare function attributesOf(element: Element): Record; /** Child nodes, via `childNodes.item`. */ export declare function childNodesOf(node: Node): Node[]; /** Class names, without relying on `DOMTokenList` being iterable. */ export declare function classNamesOf(element: Element): string[]; export {}; //# sourceMappingURL=dom-list.d.ts.map