Sha256: f9513bfa8389a0373c280a08aec8c23af8b8a8e2d18de0aced68436d60aaf3ad

Contents?: true

Size: 1.44 KB

Versions: 100

Compression:

Stored size: 1.44 KB

Contents

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

"use strict";

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

		if ( this[ 0 ] ) {
			if ( isFunction( html ) ) {
				html = html.call( 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 ( 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 htmlIsFunction = isFunction( html );

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

	unwrap: function( selector ) {
		this.parent( selector ).not( "body" ).each( function() {
			jQuery( this ).replaceWith( this.childNodes );
		} );
		return this;
	}
} );

return jQuery;
} );

Version data entries

100 entries across 87 versions & 13 rubygems

Version Path
card-mod-bootstrap-0.18.1 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
trusty-cms-6.3.1 node_modules/jquery-treetable/node_modules/jquery/src/wrap.js
trusty-cms-6.3.1 node_modules/jquery-ujs/node_modules/jquery/src/wrap.js
trusty-cms-6.3.1 node_modules/jquery/src/wrap.js
card-mod-bootstrap-0.18.0 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.17.0 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
optimacms-0.1.61 spec/dummy/node_modules/jquery-ujs/node_modules/jquery/src/wrap.js
optimacms-0.1.61 spec/dummy/node_modules/cocoon-js/node_modules/jquery/src/wrap.js
card-mod-bootstrap-0.16.0 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.6 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.5 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
udt-itf-theme-0.1.0 _sass/node_modules/jquery/src/wrap.js
card-mod-bootstrap-0.15.4 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.3 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.1.2 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.2.pre1 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.1.1 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.1 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
card-mod-bootstrap-0.15.0 vendor/bootswatch/docs/3/bower_components/jquery/src/wrap.js
trusty-cms-5.0.7 node_modules/jquery/src/wrap.js