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
dune-dashboard-1.0.7 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.0.6 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.0.5 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.0.4 vendor/assets/components/jquery/src/wrap.js
agile-proxy-0.1.20 assets/ui/bower_components/jquery/src/wrap.js
agile-proxy-0.1.19 assets/ui/bower_components/jquery/src/wrap.js
dune-dashboard-1.0.3 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.0.2 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.0.1 vendor/assets/components/jquery/src/wrap.js
dune-dashboard-1.0.0 vendor/assets/components/jquery/src/wrap.js
praxis-0.13.0 lib/api_browser/app/bower_components/jquery/src/wrap.js
agile-proxy-0.1.18 assets/ui/bower_components/jquery/src/wrap.js
agile-proxy-0.1.13 assets/ui/bower_components/jquery/src/wrap.js
praxis-0.11.2 lib/api_browser/app/bower_components/jquery/src/wrap.js
hyhyhy-1.0.0 lib/hyhyhy/structure/_includes/jquery/src/wrap.js
praxis-0.11.1 lib/api_browser/app/bower_components/jquery/src/wrap.js
praxis-0.11 lib/api_browser/app/bower_components/jquery/src/wrap.js
agile-proxy-0.1.12 assets/ui/bower_components/jquery/src/wrap.js
praxis-0.11pre lib/api_browser/app/bower_components/jquery/src/wrap.js
hyhyhy-0.0.9 lib/hyhyhy/structure/_includes/jquery/src/wrap.js