Sha256: 95cb7c61096355173e427cccedd30322b190d3cec3c17b2b298d8906077f337a

Contents?: true

Size: 1.46 KB

Versions: 417

Compression:

Stored size: 1.46 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

417 entries across 417 versions & 30 rubygems

Version Path
abstracted-0.4.22 vendor/assets/components/jquery/src/wrap.js
middleman-core-4.3.2 fixtures/import-app/bower_components/jquery/src/wrap.js
middleman-core-4.3.1 fixtures/import-app/bower_components/jquery/src/wrap.js
middleman-core-4.3.0 fixtures/import-app/bower_components/jquery/src/wrap.js
card-1.96.7 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-1.96.6 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-1.96.5 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-1.96.4 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
middleman-core-4.3.0.rc.4 fixtures/import-app/bower_components/jquery/src/wrap.js
card-1.96.3 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
middleman-core-4.3.0.rc.3 fixtures/import-app/bower_components/jquery/src/wrap.js
middleman-core-4.3.0.rc.2 fixtures/import-app/bower_components/jquery/src/wrap.js
card-1.96.2 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
abstracted-0.4.21 vendor/assets/components/jquery/src/wrap.js
epuber-0.5.6 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.5.5 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.5.4 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.5.3 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.5.2 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js
epuber-0.5.1 lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js