Sha256: a29dee20ad3ed86c4da52fce1f8d839f6b0bda4eef37538588b04e85744a7203

Contents?: true

Size: 1.48 KB

Versions: 160

Compression:

Stored size: 1.48 KB

Contents

define( [
	"./core",
	"./core/init",
	"./manipulation", // clone
	"./traversing" // parent, contents
], function( jQuery ) {

jQuery.fn.extend( {
	wrapAll: function( html ) {
		var wrap;

		if ( jQuery.isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapAll( html.call( this, i ) );
			} );
		}

		if ( this[ 0 ] ) {

			// The elements to wrap the target around
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );

			if ( this[ 0 ].parentNode ) {
				wrap.insertBefore( this[ 0 ] );
			}

			wrap.map( function() {
				var elem = this;

				while ( elem.firstElementChild ) {
					elem = elem.firstElementChild;
				}

				return elem;
			} ).append( this );
		}

		return this;
	},

	wrapInner: function( html ) {
		if ( jQuery.isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapInner( html.call( this, i ) );
			} );
		}

		return this.each( function() {
			var self = jQuery( this ),
				contents = self.contents();

			if ( contents.length ) {
				contents.wrapAll( html );

			} else {
				self.append( html );
			}
		} );
	},

	wrap: function( html ) {
		var isFunction = jQuery.isFunction( html );

		return this.each( function( i ) {
			jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
		} );
	},

	unwrap: function() {
		return this.parent().each( function() {
			if ( !jQuery.nodeName( this, "body" ) ) {
				jQuery( this ).replaceWith( this.childNodes );
			}
		} ).end();
	}
} );

return jQuery;
} );

Version data entries

160 entries across 103 versions & 10 rubygems

Version Path
epuber-0.12.0 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.11.1 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.11.0 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.10.3 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.10.2 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.10.1 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.9.3 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.9.2 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.9.1 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.9.0 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.8.0 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.7.4 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.7.3 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.7.2 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.7.1 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.7.0 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
jekyll-theme-pirati-7.7.1 _sass/foundation-sites/node_modules/jquery/src/wrap.js
jekyll-theme-pirati-7.7.1 _sass/foundation-sites/vendor/jquery/src/wrap.js
jekyll-theme-pirati-7.7.0 _sass/foundation-sites/node_modules/jquery/src/wrap.js
jekyll-theme-pirati-7.7.0 _sass/foundation-sites/vendor/jquery/src/wrap.js