appendChild(childElement) {
    const child = childElement

    if (this.nodeType === NODE_TYPES.COMMENT_NODE)
      throw new Error('This node type does not support this method.')

    if (!(child instanceof VirtualElement)) {
      const errorMessage = 'Failed to execute \'appendChild\' on \'Element\''
        + ': parameter 1 is not of type \'Element\'.'

      throw new Error(errorMessage)
    }

    child.parentElement = this
    this.#children.push(child)

    // Set nextSibling and previousSibling
    const prevKey = this.#children.length - 2

    if (prevKey >= 0) {
      this.#children[prevKey].nextSibling = child
      child.previousSibling = this.#children[prevKey]
    }
  }
/**
   * Similar to the .append method, this method is used to elements
   * in the DOM, but in this case, only accepts a Node object.
   * @param {VirtualElement} childElement
   */
Similar to the .append method, this method is used to elements
in the DOM, but in this case, only accepts a Node object.
Similar to the . append method this method is used to elements in the DOM but in this case only accepts a Node object .
appendChild(childElement) {
    const child = childElement
    if (this.nodeType === NODE_TYPES.COMMENT_NODE)
      throw new Error('This node type does not support this method.')
    if (!(child instanceof VirtualElement)) {
      const errorMessage = 'Failed to execute \'appendChild\' on \'Element\''
        + ': parameter 1 is not of type \'Element\'.'
      throw new Error(errorMessage)
    }
    child.parentElement = this
    this.#children.push(child)
    const prevKey = this.#children.length - 2
    if (prevKey >= 0) {
      this.#children[prevKey].nextSibling = child
      child.previousSibling = this.#children[prevKey]
    }
  }
appendChild ( childElement ) { const child = childElement if ( this . nodeType === NODE_TYPES . COMMENT_NODE ) throw new Error ( 'This node type does not support this method.' ) if ( ! ( child instanceof VirtualElement ) ) { const errorMessage = 'Failed to execute \'appendChild\' on \'Element\'' + ': parameter 1 is not of type \'Element\'.' throw new Error ( errorMessage ) } child . parentElement = this this . #children . push ( child ) const prevKey = this . #children . length - 2 if ( prevKey >= 0 ) { this . #children [ prevKey ] . nextSibling = child child . previousSibling = this . #children [ prevKey ] } }
Similar to the .append method, this method is used to elements
 in the DOM, but in this case, only accepts a Node object.
Similar to the . append method this method is used to elements in the DOM but in this case only accepts a Node object .
// Set nextSibling and previousSibling