jQuery 1.0.4 - New Wave Javascript(js源文件)

2019-06-03 09:49:42刘景俊


            // 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 );
        });
    },

    end: function() {
        if( !(this.stack && this.stack.length) )
            return this;
        return this.set( this.stack.pop() );