src/aria/utils/Dom.js
function (domElt, where, newElement) {
            if (Aria.$window.document.body.insertAdjacentElement) {
                this.insertAdjacentElement = function (domElt, where, newElement) {
                    domElt.insertAdjacentElement(where, newElement);
                };
            } else {
                // Firefox :'(
                this.insertAdjacentElement = function (domElt, where, newElement) {
                    if (where == "beforeBegin") {
                        domElt.parentNode.insertBefore(newElement, domElt);
                    } else if (where == "afterBegin") {
                        domElt.insertBefore(newElement, domElt.firstChild);
                    } else if (where == "beforeEnd") {
                        domElt.appendChild(newElement);
                    } else if (where == "afterEnd") {
                        domElt.parentNode.insertBefore(newElement, domElt.nextSibling);
                    } else {
                        this.$logError(this.INSERT_ADJACENT_INVALID_POSITION, [where]);
                    }
                };
            }

            this.insertAdjacentElement(domElt, where, newElement);
        }
function (domElt, where, newElement) {
            if (Aria.$window.document.body.insertAdjacentElement) {
                this.insertAdjacentElement = function (domElt, where, newElement) {
                    domElt.insertAdjacentElement(where, newElement);
                };
            } else {
                // Firefox :'(
                this.insertAdjacentElement = function (domElt, where, newElement) {
                    if (where == "beforeBegin") {
                        domElt.parentNode.insertBefore(newElement, domElt);
                    } else if (where == "afterBegin") {
                        domElt.insertBefore(newElement, domElt.firstChild);
                    } else if (where == "beforeEnd") {
                        domElt.appendChild(newElement);
                    } else if (where == "afterEnd") {
                        domElt.parentNode.insertBefore(newElement, domElt.nextSibling);
                    } else {
                        this.$logError(this.INSERT_ADJACENT_INVALID_POSITION, [where]);
                    }
                };
            }

            this.insertAdjacentElement(domElt, where, newElement);
        }
function ( domElt , where , newElement ) { if ( Aria . $window . document . body . insertAdjacentElement ) { this . insertAdjacentElement = function ( domElt , where , newElement ) { domElt . insertAdjacentElement ( where , newElement ) ; } ; } else { // Firefox :'( this . insertAdjacentElement = function ( domElt , where , newElement ) { if ( where == "beforeBegin" ) { domElt . parentNode . insertBefore ( newElement , domElt ) ; } else if ( where == "afterBegin" ) { domElt . insertBefore ( newElement , domElt . firstChild ) ; } else if ( where == "beforeEnd" ) { domElt . appendChild ( newElement ) ; } else if ( where == "afterEnd" ) { domElt . parentNode . insertBefore ( newElement , domElt . nextSibling ) ; } else { this . $logError ( this . INSERT_ADJACENT_INVALID_POSITION , [ where ] ) ; } } ; } this . insertAdjacentElement ( domElt , where , newElement ) ; }
Insert the given HTML element into the document at the specified location. This method is cross-browser
compatbile. When possible, it relies on the insertAdjacentElement method, otherwise, it relies on
insertBefore and appendChild.
@param {HTMLElement} domElt Reference DOM element
@param {String} where maybe beforeBegin, afterBegin, beforeEnd or afterEnd
@param {String} html HTML markup to insert at that place
Insert the given HTML element into the document at the specified location . This method is cross - browser compatbile . When possible it relies on the insertAdjacentElement method otherwise it relies on insertBefore and appendChild .