AMD-ify jQuery sourcegit s! Woo! Fixes #14113, #14163.

This commit is contained in:
Timmy Willison
2013-08-15 14:15:49 -04:00
parent 7627b8b6d9
commit 6318ae6ab9
77 changed files with 27783 additions and 1580 deletions

View File

@@ -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;
}
}
});