docs/vendor/mixitup/mixitup.js
function(isResetting, operation) {
            var self        = this,
                startOrder  = isResetting ? operation.newOrder : operation.startOrder,
                newOrder    = isResetting ? operation.startOrder : operation.newOrder,
                nextSibling = startOrder.length ? startOrder[startOrder.length - 1].dom.el.nextElementSibling : null,
                frag        = window.document.createDocumentFragment(),
                whitespace  = null,
                target      = null,
                el          = null,
                i           = -1;

            self.callActions('beforePrintSort', arguments);

            // Empty the container

            for (i = 0; target = startOrder[i]; i++) {
                el = target.dom.el;

                if (el.style.position === 'absolute') continue;

                h.removeWhitespace(el.previousSibling);

                el.parentElement.removeChild(el);
            }

            whitespace = nextSibling ? nextSibling.previousSibling : self.dom.parent.lastChild;

            if (whitespace && whitespace.nodeName === '#text') {
                h.removeWhitespace(whitespace);
            }

            for (i = 0; target = newOrder[i]; i++) {
                // Add targets into a document fragment

                el = target.dom.el;

                if (h.isElement(frag.lastChild)) {
                    frag.appendChild(window.document.createTextNode(' '));
                }

                frag.appendChild(el);
            }

            // Insert the document fragment into the container
            // before any other non-target elements

            if (self.dom.parent.firstChild && self.dom.parent.firstChild !== nextSibling) {
                frag.insertBefore(window.document.createTextNode(' '), frag.childNodes[0]);
            }

            if (nextSibling) {
                frag.appendChild(window.document.createTextNode(' '));

                self.dom.parent.insertBefore(frag, nextSibling);
            } else {
                self.dom.parent.appendChild(frag);
            }

            self.callActions('afterPrintSort', arguments);
        }
function(isResetting, operation) {
            var self        = this,
                startOrder  = isResetting ? operation.newOrder : operation.startOrder,
                newOrder    = isResetting ? operation.startOrder : operation.newOrder,
                nextSibling = startOrder.length ? startOrder[startOrder.length - 1].dom.el.nextElementSibling : null,
                frag        = window.document.createDocumentFragment(),
                whitespace  = null,
                target      = null,
                el          = null,
                i           = -1;

            self.callActions('beforePrintSort', arguments);

            // Empty the container

            for (i = 0; target = startOrder[i]; i++) {
                el = target.dom.el;

                if (el.style.position === 'absolute') continue;

                h.removeWhitespace(el.previousSibling);

                el.parentElement.removeChild(el);
            }

            whitespace = nextSibling ? nextSibling.previousSibling : self.dom.parent.lastChild;

            if (whitespace && whitespace.nodeName === '#text') {
                h.removeWhitespace(whitespace);
            }

            for (i = 0; target = newOrder[i]; i++) {
                // Add targets into a document fragment

                el = target.dom.el;

                if (h.isElement(frag.lastChild)) {
                    frag.appendChild(window.document.createTextNode(' '));
                }

                frag.appendChild(el);
            }

            // Insert the document fragment into the container
            // before any other non-target elements

            if (self.dom.parent.firstChild && self.dom.parent.firstChild !== nextSibling) {
                frag.insertBefore(window.document.createTextNode(' '), frag.childNodes[0]);
            }

            if (nextSibling) {
                frag.appendChild(window.document.createTextNode(' '));

                self.dom.parent.insertBefore(frag, nextSibling);
            } else {
                self.dom.parent.appendChild(frag);
            }

            self.callActions('afterPrintSort', arguments);
        }
function ( isResetting , operation ) { var self = this , startOrder = isResetting ? operation . newOrder : operation . startOrder , newOrder = isResetting ? operation . startOrder : operation . newOrder , nextSibling = startOrder . length ? startOrder [ startOrder . length - 1 ] . dom . el . nextElementSibling : null , frag = window . document . createDocumentFragment ( ) , whitespace = null , target = null , el = null , i = - 1 ; self . callActions ( 'beforePrintSort' , arguments ) ; // Empty the container for ( i = 0 ; target = startOrder [ i ] ; i ++ ) { el = target . dom . el ; if ( el . style . position === 'absolute' ) continue ; h . removeWhitespace ( el . previousSibling ) ; el . parentElement . removeChild ( el ) ; } whitespace = nextSibling ? nextSibling . previousSibling : self . dom . parent . lastChild ; if ( whitespace && whitespace . nodeName === '#text' ) { h . removeWhitespace ( whitespace ) ; } for ( i = 0 ; target = newOrder [ i ] ; i ++ ) { // Add targets into a document fragment el = target . dom . el ; if ( h . isElement ( frag . lastChild ) ) { frag . appendChild ( window . document . createTextNode ( ' ' ) ) ; } frag . appendChild ( el ) ; } // Insert the document fragment into the container // before any other non-target elements if ( self . dom . parent . firstChild && self . dom . parent . firstChild !== nextSibling ) { frag . insertBefore ( window . document . createTextNode ( ' ' ) , frag . childNodes [ 0 ] ) ; } if ( nextSibling ) { frag . appendChild ( window . document . createTextNode ( ' ' ) ) ; self . dom . parent . insertBefore ( frag , nextSibling ) ; } else { self . dom . parent . appendChild ( frag ) ; } self . callActions ( 'afterPrintSort' , arguments ) ; }
Inserts elements into the DOM in the appropriate
order using a document fragment for minimal
DOM thrashing

@private
@instance
@since   2.0.0
@param   {boolean}   isResetting
@param   {Operation} operation
@return  {void}
Inserts elements into the DOM in the appropriate order using a document fragment for minimal DOM thrashing