jQuery 1.0.2

2020-05-23 06:10:44易采站长站整理

        return this.each(function(){
            // Clone the structure that we’re using to wrap
            var b = a[0].cloneNode(true);
            // Insert it before the element to be wrapped
            this.parentNode.insertBefore( b, this );
            // Find the deepest point in the wrap structure
            while ( b.firstChild )
                b = b.firstChild;
            // Move the matched element to within the wrap structure
            b.appendChild( this );
        });
    },
    append: function() {
        return this.domManip(arguments, true, 1, function(a){
            this.appendChild( a );
        });
    },
    prepend: function() {
        return this.domManip(arguments, true, -1, function(a){
            this.insertBefore( a, this.firstChild );
        });
    },
    before: function() {
        return this.domManip(arguments, false, 1, function(a){
            this.parentNode.insertBefore( a, this );
        });
    },
    after: function() {
        return this.domManip(arguments, false, -1, function(a){
            this.parentNode.insertBefore( a, this.nextSibling );
        });
    },