Sha256: 19764ef4adbdacee29da545772af3c28e978ff4986e1e22a50c962ba1ca9a8f0

Contents?: true

Size: 1.43 KB

Versions: 148

Compression:

Stored size: 1.43 KB

Contents

define([
	"./core",
	"./core/init",
	"./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

148 entries across 148 versions & 13 rubygems

Version Path
kms-0.9.0 vendor/assets/bower_components/jquery/src/wrap.js
kms-0.8.0 vendor/assets/bower_components/jquery/src/wrap.js
TokiCLI-0.3.1 lib/TokiServer/bower_components/jquery/src/wrap.js
kms-0.7.0 vendor/assets/bower_components/jquery/src/wrap.js
kms-0.6.0 vendor/assets/bower_components/jquery/src/wrap.js
kms-0.5.0 vendor/assets/bower_components/jquery/src/wrap.js
kms-0.4.2 vendor/assets/bower_components/jquery/src/wrap.js
wrgem-0.0.55 lib/generators/wrstart/template/vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.1.5 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.1.4 vendor/assets/components/jquery/src/wrap.js
wrgem-0.0.54 lib/generators/wrstart/template/vendor/assets/components/jquery/src/wrap.js
praxis-0.19.0 lib/api_browser/app/bower_components/jquery/src/wrap.js
wrgem-0.0.53 lib/generators/wrstart/template/vendor/assets/components/jquery/src/wrap.js
wrgem-0.0.52 lib/generators/wrstart/template/vendor/assets/components/jquery/src/wrap.js
wrgem-0.0.51 lib/generators/wrstart/template/vendor/assets/components/jquery/src/wrap.js
praxis-0.18.1 lib/api_browser/app/bower_components/jquery/src/wrap.js
praxis-0.18.0 lib/api_browser/app/bower_components/jquery/src/wrap.js
praxis-0.17.1 lib/api_browser/app/bower_components/jquery/src/wrap.js
praxis-0.17.0 lib/api_browser/app/bower_components/jquery/src/wrap.js
praxis-0.16.1 lib/api_browser/app/bower_components/jquery/src/wrap.js