aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/manipulation.js')
-rw-r--r--src/manipulation.js51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 00d65de5a..55a77f4e8 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -1,4 +1,4 @@
-define([
+define( [
"./core",
"./var/concat",
"./var/push",
@@ -28,6 +28,7 @@ define([
var
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
rnoInnerhtml = /<(?:script|style|link)/i,
+
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptTypeMasked = /^true\/(.*)/,
@@ -45,7 +46,7 @@ function manipulationTarget( elem, content ) {
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
- elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
+ elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
@@ -54,7 +55,7 @@ function restoreScript( elem ) {
if ( match ) {
elem.type = match[ 1 ];
} else {
- elem.removeAttribute("type");
+ elem.removeAttribute( "type" );
}
return elem;
@@ -124,13 +125,13 @@ function domManip( collection, args, callback, ignored ) {
if ( isFunction ||
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) ) {
- return collection.each(function( index ) {
+ return collection.each( function( index ) {
var self = collection.eq( index );
if ( isFunction ) {
args[ 0 ] = value.call( this, index, self.html() );
}
domManip( self, args, callback, ignored );
- });
+ } );
}
if ( l ) {
@@ -157,6 +158,7 @@ function domManip( collection, args, callback, ignored ) {
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
+
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
@@ -180,6 +182,7 @@ function domManip( collection, args, callback, ignored ) {
jQuery.contains( doc, node ) ) {
if ( node.src ) {
+
// Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl ) {
jQuery._evalUrl( node.src );
@@ -201,7 +204,7 @@ function remove( elem, selector, keepData ) {
nodes = selector ? jQuery.filter( selector, elem ) : elem,
i = 0;
- for ( ; (node = nodes[i]) != null; i++ ) {
+ for ( ; ( node = nodes[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) );
}
@@ -217,7 +220,7 @@ function remove( elem, selector, keepData ) {
return elem;
}
-jQuery.extend({
+jQuery.extend( {
htmlPrefilter: function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
},
@@ -269,9 +272,9 @@ jQuery.extend({
special = jQuery.event.special,
i = 0;
- for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
+ for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
if ( jQuery.acceptData( elem ) ) {
- if ( (data = elem[ dataPriv.expando ] ) ) {
+ if ( ( data = elem[ dataPriv.expando ] ) ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
@@ -291,9 +294,9 @@ jQuery.extend({
}
}
}
-});
+} );
-jQuery.fn.extend({
+jQuery.fn.extend( {
detach: function( selector ) {
return remove( this, selector, true );
},
@@ -306,11 +309,11 @@ jQuery.fn.extend({
return access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
- this.empty().each(function() {
+ this.empty().each( function() {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.textContent = value;
}
- });
+ } );
}, null, value, arguments.length );
},
@@ -320,7 +323,7 @@ jQuery.fn.extend({
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
- });
+ } );
},
prepend: function() {
@@ -329,7 +332,7 @@ jQuery.fn.extend({
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
- });
+ } );
},
before: function() {
@@ -337,7 +340,7 @@ jQuery.fn.extend({
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
- });
+ } );
},
after: function() {
@@ -345,14 +348,14 @@ jQuery.fn.extend({
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
- });
+ } );
},
empty: function() {
var elem,
i = 0;
- for ( ; (elem = this[i]) != null; i++ ) {
+ for ( ; ( elem = this[ i ] ) != null; i++ ) {
if ( elem.nodeType === 1 ) {
// Prevent memory leaks
@@ -370,9 +373,9 @@ jQuery.fn.extend({
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
- return this.map(function() {
+ return this.map( function() {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
+ } );
},
html: function( value ) {
@@ -431,9 +434,9 @@ jQuery.fn.extend({
// Force callback invocation
}, ignored );
}
-});
+} );
-jQuery.each({
+jQuery.each( {
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
@@ -458,7 +461,7 @@ jQuery.each({
return this.pushStack( ret );
};
-});
+} );
return jQuery;
-});
+} );