Nodejs HTML Element Append appendFirst(el)

Here you can find the source of appendFirst(el)

Method Source Code

HTMLElement.prototype.appendFirst = function(el) {
   if (!el) return;

   if (this.firstChild) {
      this.insertBefore(el, this.firstChild)
   } else {// www  .j a v a 2 s  . c  o m
      this.appendChild(el);
   }
}

Related

  1. append(element)
    HTMLElement.prototype.append = function(element){
        this.appendChild(typeof element === 'string' ?
            document.createTextNode(element) : element);
    };
    
  2. appendAfter(element)
    Element.prototype.appendAfter = function(element) {
      return element.parentNode.insertBefore(this, element.nextSibling);
    }, false;
    
  3. appendBefore(element)
    Element.prototype.appendBefore = function(element) {
      return element.parentNode.insertBefore(this, element);
    }, false;
    
  4. append(child)
    HTMLElement.prototype.append = function append(child) {
        this.appendChild(child);
        return this;
    };