1 import { jQuery } from "./core.js";
3 import "./core/init.js";
4 import "./manipulation.js"; // clone
5 import "./traversing.js"; // parent, contents
8 wrapAll: function( html ) {
12 if ( typeof html === "function" ) {
13 html = html.call( this[ 0 ] );
16 // The elements to wrap the target around
17 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
19 if ( this[ 0 ].parentNode ) {
20 wrap.insertBefore( this[ 0 ] );
23 wrap.map( function() {
26 while ( elem.firstElementChild ) {
27 elem = elem.firstElementChild;
37 wrapInner: function( html ) {
38 if ( typeof html === "function" ) {
39 return this.each( function( i ) {
40 jQuery( this ).wrapInner( html.call( this, i ) );
44 return this.each( function() {
45 var self = jQuery( this ),
46 contents = self.contents();
48 if ( contents.length ) {
49 contents.wrapAll( html );
57 wrap: function( html ) {
58 var htmlIsFunction = typeof html === "function";
60 return this.each( function( i ) {
61 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
65 unwrap: function( selector ) {
66 this.parent( selector ).not( "body" ).each( function() {
67 jQuery( this ).replaceWith( this.childNodes );
73 export { jQuery, jQuery as $ };