aboutsummaryrefslogtreecommitdiffstats
path: root/src/manipulation.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2013-08-15 14:15:49 -0400
committerTimmy Willison <timmywillisn@gmail.com>2013-08-15 14:15:49 -0400
commit6318ae6ab90d4b450dfadf32ab95fe52ed6331cb (patch)
tree50b247fed8569e909e380b281e9145bd1458a39e /src/manipulation.js
parent7627b8b6d9ef6e57dbd20a55b946bd1991c1223e (diff)
downloadjquery-6318ae6ab90d4b450dfadf32ab95fe52ed6331cb.tar.gz
jquery-6318ae6ab90d4b450dfadf32ab95fe52ed6331cb.zip
AMD-ify jQuery sourcegit s! Woo! Fixes #14113, #14163.
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 19494ae2d..8eabb1979 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -1,8 +1,20 @@
+define([
+ "./core",
+ "./var/concat",
+ "./var/push",
+ "./manipulation/var/rcheckableType",
+ "./data/var/data_priv",
+ "./data/var/data_user",
+ "./data/accepts",
+ "./selector",
+ "./traversing",
+ "./event"
+], function( jQuery, concat, push, rcheckableType, data_priv, data_user ){
+
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
- manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
@@ -72,8 +84,7 @@ jQuery.fn.extend({
});
},
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
+ remove: function( selector, keepData /* Internal Use Only */ ) {
var elem,
elems = selector ? jQuery.filter( selector, this ) : this,
i = 0;
@@ -195,7 +206,7 @@ jQuery.fn.extend({
domManip: function( args, callback, allowIntersection ) {
// Flatten any nested arrays
- args = core_concat.apply( [], args );
+ args = concat.apply( [], args );
var fragment, first, scripts, hasScripts, node, doc,
i = 0,
@@ -239,7 +250,7 @@ jQuery.fn.extend({
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
// Support: QtWebKit
- // jQuery.merge because core_push.apply(_, arraylike) throws
+ // jQuery.merge because push.apply(_, arraylike) throws
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
@@ -260,8 +271,10 @@ jQuery.fn.extend({
!data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
- // Hope ajax is available...
- jQuery._evalUrl( node.src );
+ // Optional AJAX dependency, but won't run scripts if not present
+ if ( jQuery._evalUrl ) {
+ jQuery._evalUrl( node.src );
+ }
} else {
jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
}
@@ -294,8 +307,8 @@ jQuery.each({
jQuery( insert[ i ] )[ original ]( elems );
// Support: QtWebKit
- // .get() because core_push.apply(_, arraylike) throws
- core_push.apply( ret, elems.get() );
+ // .get() because push.apply(_, arraylike) throws
+ push.apply( ret, elems.get() );
}
return this.pushStack( ret );
@@ -360,7 +373,7 @@ jQuery.extend({
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
// Support: QtWebKit
- // jQuery.merge because core_push.apply(_, arraylike) throws
+ // jQuery.merge because push.apply(_, arraylike) throws
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
@@ -383,7 +396,7 @@ jQuery.extend({
}
// Support: QtWebKit
- // jQuery.merge because core_push.apply(_, arraylike) throws
+ // jQuery.merge because push.apply(_, arraylike) throws
jQuery.merge( nodes, tmp.childNodes );
// Remember the top-level container
@@ -438,7 +451,7 @@ jQuery.extend({
i = 0;
for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
- if ( Data.accepts( elem ) ) {
+ if ( jQuery.acceptData( elem ) ) {
key = elem[ data_priv.expando ];
if ( key && (data = data_priv.cache[ key ]) ) {
@@ -463,17 +476,6 @@ jQuery.extend({
// Discard any remaining `user` data
delete data_user.cache[ elem[ data_user.expando ] ];
}
- },
-
- _evalUrl: function( url ) {
- return jQuery.ajax({
- url: url,
- type: "GET",
- dataType: "script",
- async: false,
- global: false,
- "throws": true
- });
}
});
@@ -567,7 +569,7 @@ function fixInput( src, dest ) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
- if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
@@ -575,3 +577,4 @@ function fixInput( src, dest ) {
dest.defaultValue = src.defaultValue;
}
}
+});