File

projects/wms-framework/src/lib/helpers/BrowserElement.ts

Description

Provides helper functions for HTML element manipulation.

Index

Methods

Methods

Static removeChild
removeChild(parent: Node, child: Node)

Removes a child from it's parent. NOTE: if the child does not belong to parent, no exception is thrown.

Parameters :
Name Type Optional Description
parent Node No

The parent element.

child Node No

The child to remove.

Returns : void
export class BrowserElement {
  /**
   * Removes a child from it's parent.
   * NOTE: if the child does not belong to parent, no exception is thrown.
   *
   * @static
   * @param {HTMLElement} parent The parent element.
   * @param {HTMLElement} child The child to remove.
   * @memberof BrowserElement
   */
  public static removeChild(parent: Node, child: Node): void {
    try {
      parent.removeChild(child);
    } catch (e) {
      console.warn(
        'WARNING: BrowserElement.removeChild() was unable to remove the child.'
      );
      console.warn(e);
    }
  }
}

result-matching ""

    No results matching ""