node-html-parser 6.1.13 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,8 @@ export interface Attributes {
11
11
  export interface RawAttributes {
12
12
  [key: string]: string;
13
13
  }
14
- export declare type InsertPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
14
+ export type InsertPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
15
+ export type NodeInsertable = Node | string;
15
16
  declare class DOMTokenList {
16
17
  private _set;
17
18
  private _afterUpdate;
@@ -152,16 +153,6 @@ export default class HTMLElement extends Node {
152
153
  * @return {Node} node appended
153
154
  */
154
155
  appendChild<T extends Node = Node>(node: T): T;
155
- /**
156
- * Get first child node
157
- * @return {Node | undefined} first child node; or undefined if none
158
- */
159
- get firstChild(): Node | undefined;
160
- /**
161
- * Get last child node
162
- * @return {Node | undefined} last child node; or undefined if none
163
- */
164
- get lastChild(): Node | undefined;
165
156
  /**
166
157
  * Get attributes
167
158
  * @access private
@@ -193,14 +184,43 @@ export default class HTMLElement extends Node {
193
184
  */
194
185
  setAttributes(attributes: Attributes): this;
195
186
  insertAdjacentHTML(where: InsertPosition, html: string): this;
187
+ /** Prepend nodes or strings to this node's children. */
188
+ prepend(...insertable: NodeInsertable[]): void;
189
+ /** Append nodes or strings to this node's children. */
190
+ append(...insertable: NodeInsertable[]): void;
191
+ /** Insert nodes or strings before this node. */
192
+ before(...insertable: NodeInsertable[]): void;
193
+ /** Insert nodes or strings after this node. */
194
+ after(...insertable: NodeInsertable[]): void;
196
195
  get nextSibling(): Node | null;
197
196
  get nextElementSibling(): HTMLElement | null;
198
197
  get previousSibling(): Node | null;
199
198
  get previousElementSibling(): HTMLElement | null;
200
- get classNames(): string;
199
+ /** Get all childNodes of type {@link HTMLElement}. */
200
+ get children(): HTMLElement[];
201
+ /**
202
+ * Get the first child node.
203
+ * @return The first child or undefined if none exists.
204
+ */
205
+ get firstChild(): Node | undefined;
206
+ /**
207
+ * Get the first child node of type {@link HTMLElement}.
208
+ * @return The first child element or undefined if none exists.
209
+ */
210
+ get firstElementChild(): HTMLElement | undefined;
201
211
  /**
202
- * Clone this Node
212
+ * Get the last child node.
213
+ * @return The last child or undefined if none exists.
203
214
  */
215
+ get lastChild(): Node | undefined;
216
+ /**
217
+ * Get the last child node of type {@link HTMLElement}.
218
+ * @return The last child element or undefined if none exists.
219
+ */
220
+ get lastElementChild(): HTMLElement | undefined;
221
+ get childElementCount(): number;
222
+ get classNames(): string;
223
+ /** Clone this Node */
204
224
  clone(): Node;
205
225
  }
206
226
  export interface Options {