Commit a101e81b authored by Richard Gibson's avatar Richard Gibson Committed by Dave Methvin

Interim take on cross-module variables, closes gh-817.

parent 46d68045
...@@ -11,7 +11,6 @@ var r20 = /%20/g, ...@@ -11,7 +11,6 @@ var r20 = /%20/g,
rquery = /\?/, rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i, rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/, rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
...@@ -72,7 +71,7 @@ function addToPrefiltersOrTransports( structure ) { ...@@ -72,7 +71,7 @@ function addToPrefiltersOrTransports( structure ) {
} }
if ( jQuery.isFunction( func ) ) { if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ), var dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
i = 0, i = 0,
length = dataTypes.length, length = dataTypes.length,
dataType, dataType,
...@@ -613,7 +612,7 @@ jQuery.extend({ ...@@ -613,7 +612,7 @@ jQuery.extend({
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list // Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
// Determine if a cross-domain request is in order // Determine if a cross-domain request is in order
if ( s.crossDomain == null ) { if ( s.crossDomain == null ) {
......
var rclass = /[\n\t\r]/g, var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g, rreturn = /\r/g,
rtype = /^(?:button|input)$/i, rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i,
...@@ -45,7 +44,7 @@ jQuery.fn.extend({ ...@@ -45,7 +44,7 @@ jQuery.fn.extend({
} }
if ( value && typeof value === "string" ) { if ( value && typeof value === "string" ) {
classNames = value.split( rspace ); classNames = value.split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) { for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ]; elem = this[ i ];
...@@ -81,7 +80,7 @@ jQuery.fn.extend({ ...@@ -81,7 +80,7 @@ jQuery.fn.extend({
} }
if ( (value && typeof value === "string") || value === undefined ) { if ( (value && typeof value === "string") || value === undefined ) {
classNames = ( value || "" ).split( rspace ); classNames = ( value || "" ).split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) { for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ]; elem = this[ i ];
...@@ -121,7 +120,7 @@ jQuery.fn.extend({ ...@@ -121,7 +120,7 @@ jQuery.fn.extend({
i = 0, i = 0,
self = jQuery( this ), self = jQuery( this ),
state = stateVal, state = stateVal,
classNames = value.split( rspace ); classNames = value.split( core_rspace );
while ( (className = classNames[ i++ ]) ) { while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list // check each className given, space seperated list
...@@ -359,7 +358,7 @@ jQuery.extend({ ...@@ -359,7 +358,7 @@ jQuery.extend({
value = value.toLowerCase(); value = value.toLowerCase();
} }
attrNames = value.split( rspace ); attrNames = value.split( core_rspace );
l = attrNames.length; l = attrNames.length;
for ( ; i < l; i++ ) { for ( ; i < l; i++ ) {
......
...@@ -4,7 +4,7 @@ var optionsCache = {}; ...@@ -4,7 +4,7 @@ var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache // Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) { function createOptions( options ) {
var object = optionsCache[ options ] = {}; var object = optionsCache[ options ] = {};
jQuery.each( options.split( /\s+/ ), function( _, flag ) { jQuery.each( options.split( core_rspace ), function( _, flag ) {
object[ flag ] = true; object[ flag ] = true;
}); });
return object; return object;
......
// Use the correct document accordingly with window argument (sandbox) var
var document = window.document, // Use the correct document accordingly with window argument (sandbox)
navigator = window.navigator, document = window.document,
location = window.location, location = window.location,
navigator = window.navigator,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// Save a reference to some core methods // Save a reference to some core methods
toString = Object.prototype.toString, core_push = Array.prototype.push,
hasOwn = Object.prototype.hasOwnProperty, core_slice = Array.prototype.slice,
push = Array.prototype.push, core_indexOf = Array.prototype.indexOf,
slice = Array.prototype.slice, core_toString = Object.prototype.toString,
trim = String.prototype.trim, core_hasOwn = Object.prototype.hasOwnProperty,
indexOf = Array.prototype.indexOf, core_trim = String.prototype.trim,
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -17,44 +24,43 @@ var document = window.document, ...@@ -17,44 +24,43 @@ var document = window.document,
return new jQuery.fn.init( selector, context, rootjQuery ); return new jQuery.fn.init( selector, context, rootjQuery );
}, },
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document) // A central reference to the root jQuery(document)
rootjQuery, rootjQuery,
// A simple way to check for HTML strings or ID strings // The deferred used on DOM ready
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) readyList,
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it // For matching the engine and version of the browser
rnotwhite = /\S/, browserMatch,
// Used for trimming whitespace // Used for detecting and trimming whitespace
core_rnotwhite = /\S/,
core_rspace = /\s+/,
trimLeft = /^\s+/, trimLeft = /^\s+/,
trimRight = /\s+$/, trimRight = /\s+$/,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Match a standalone tag // Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp // JSON RegExp
rvalidchars = /^[\],:{}\s]*$/, rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
// Useragent RegExp // Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/, rmsie = /(msie) ([\w.]+)/,
rwebkit = /(webkit)[ \/]([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
// Matches dashed string for camelizing // Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/, rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace() // Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) { fcamelCase = function( all, letter ) {
...@@ -64,12 +70,6 @@ var document = window.document, ...@@ -64,12 +70,6 @@ var document = window.document,
// Keep a UserAgent string for use with jQuery.browser // Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent, userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler and self cleanup method // The ready event handler and self cleanup method
DOMContentLoaded = function() { DOMContentLoaded = function() {
if ( document.addEventListener ) { if ( document.addEventListener ) {
...@@ -200,7 +200,7 @@ jQuery.fn = jQuery.prototype = { ...@@ -200,7 +200,7 @@ jQuery.fn = jQuery.prototype = {
}, },
toArray: function() { toArray: function() {
return slice.call( this ); return core_slice.call( this );
}, },
// Get the Nth element in the matched element set OR // Get the Nth element in the matched element set OR
...@@ -222,7 +222,7 @@ jQuery.fn = jQuery.prototype = { ...@@ -222,7 +222,7 @@ jQuery.fn = jQuery.prototype = {
var ret = this.constructor(); var ret = this.constructor();
if ( jQuery.isArray( elems ) ) { if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems ); core_push.apply( ret, elems );
} else { } else {
jQuery.merge( ret, elems ); jQuery.merge( ret, elems );
...@@ -273,8 +273,8 @@ jQuery.fn = jQuery.prototype = { ...@@ -273,8 +273,8 @@ jQuery.fn = jQuery.prototype = {
}, },
slice: function() { slice: function() {
return this.pushStack( slice.apply( this, arguments ), return this.pushStack( core_slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") ); "slice", core_slice.call(arguments).join(",") );
}, },
map: function( callback ) { map: function( callback ) {
...@@ -289,7 +289,7 @@ jQuery.fn = jQuery.prototype = { ...@@ -289,7 +289,7 @@ jQuery.fn = jQuery.prototype = {
// For internal use only. // For internal use only.
// Behaves like an Array's method, not like a jQuery method. // Behaves like an Array's method, not like a jQuery method.
push: push, push: core_push,
sort: [].sort, sort: [].sort,
splice: [].splice splice: [].splice
}; };
...@@ -440,7 +440,7 @@ jQuery.extend({ ...@@ -440,7 +440,7 @@ jQuery.extend({
type: function( obj ) { type: function( obj ) {
return obj == null ? return obj == null ?
String( obj ) : String( obj ) :
class2type[ toString.call(obj) ] || "object"; class2type[ core_toString.call(obj) ] || "object";
}, },
isPlainObject: function( obj ) { isPlainObject: function( obj ) {
...@@ -454,8 +454,8 @@ jQuery.extend({ ...@@ -454,8 +454,8 @@ jQuery.extend({
try { try {
// Not own constructor property must be Object // Not own constructor property must be Object
if ( obj.constructor && if ( obj.constructor &&
!hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false; return false;
} }
} catch ( e ) { } catch ( e ) {
...@@ -469,7 +469,7 @@ jQuery.extend({ ...@@ -469,7 +469,7 @@ jQuery.extend({
var key; var key;
for ( key in obj ) {} for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key ); return key === undefined || core_hasOwn.call( obj, key );
}, },
isEmptyObject: function( obj ) { isEmptyObject: function( obj ) {
...@@ -538,7 +538,7 @@ jQuery.extend({ ...@@ -538,7 +538,7 @@ jQuery.extend({
// Workarounds based on findings by Jim Driscoll // Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) { globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) { if ( data && core_rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer // We use execScript on Internet Explorer
// We use an anonymous function so that context is window // We use an anonymous function so that context is window
// rather than jQuery in Firefox // rather than jQuery in Firefox
...@@ -600,11 +600,11 @@ jQuery.extend({ ...@@ -600,11 +600,11 @@ jQuery.extend({
}, },
// Use native String.trim function wherever possible // Use native String.trim function wherever possible
trim: trim ? trim: core_trim ?
function( text ) { function( text ) {
return text == null ? return text == null ?
"" : "" :
trim.call( text ); core_trim.call( text );
} : } :
// Otherwise use our own trimming functionality // Otherwise use our own trimming functionality
...@@ -624,7 +624,7 @@ jQuery.extend({ ...@@ -624,7 +624,7 @@ jQuery.extend({
var type = jQuery.type( array ); var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array ); core_push.call( ret, array );
} else { } else {
jQuery.merge( ret, array ); jQuery.merge( ret, array );
} }
...@@ -637,8 +637,8 @@ jQuery.extend({ ...@@ -637,8 +637,8 @@ jQuery.extend({
var len; var len;
if ( array ) { if ( array ) {
if ( indexOf ) { if ( core_indexOf ) {
return indexOf.call( array, elem, i ); return core_indexOf.call( array, elem, i );
} }
len = array.length; len = array.length;
...@@ -743,9 +743,9 @@ jQuery.extend({ ...@@ -743,9 +743,9 @@ jQuery.extend({
} }
// Simulated bind // Simulated bind
var args = slice.call( arguments, 2 ), var args = core_slice.call( arguments, 2 ),
proxy = function() { proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) ); return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
}; };
// Set the guid of unique handler to the same of original handler, so it can be removed // Set the guid of unique handler to the same of original handler, so it can be removed
...@@ -910,7 +910,7 @@ if ( jQuery.browser.webkit ) { ...@@ -910,7 +910,7 @@ if ( jQuery.browser.webkit ) {
} }
// IE doesn't match non-breaking spaces with \s // IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) { if ( core_rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/; trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/; trimRight = /[\s\xA0]+$/;
} }
......
...@@ -70,7 +70,7 @@ function showHide( elements, show ) { ...@@ -70,7 +70,7 @@ function showHide( elements, show ) {
// for such an element // for such an element
if ( (elem.style.display === "" && curCSS( elem, "display" ) === "none") || if ( (elem.style.display === "" && curCSS( elem, "display" ) === "none") ||
!jQuery.contains( elem.ownerDocument.documentElement, elem ) ) { !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
} }
} else { } else {
display = curCSS( elem, "display" ); display = curCSS( elem, "display" );
...@@ -434,7 +434,7 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -434,7 +434,7 @@ function getWidthOrHeight( elem, name, extra ) {
// Try to determine the default display value of an element // Try to determine the default display value of an element
function defaultDisplay( nodeName ) { function css_defaultDisplay( nodeName ) {
if ( elemdisplay[ nodeName ] ) { if ( elemdisplay[ nodeName ] ) {
return elemdisplay[ nodeName ]; return elemdisplay[ nodeName ];
} }
......
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({ jQuery.extend({
Deferred: function( func ) { Deferred: function( func ) {
...@@ -93,7 +90,7 @@ jQuery.extend({ ...@@ -93,7 +90,7 @@ jQuery.extend({
// Deferred helper // Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) { when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0, var i = 0,
resolveValues = sliceDeferred.call( arguments ), resolveValues = core_slice.call( arguments ),
length = resolveValues.length, length = resolveValues.length,
// the count of uncompleted subordinates // the count of uncompleted subordinates
...@@ -106,7 +103,7 @@ jQuery.extend({ ...@@ -106,7 +103,7 @@ jQuery.extend({
updateFunc = function( i, contexts, values ) { updateFunc = function( i, contexts, values ) {
return function( value ) { return function( value ) {
contexts[ i ] = this; contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments ) : value; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) { if( values === progressValues ) {
deferred.notifyWith( contexts, values ); deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) { } else if ( !( --remaining ) ) {
......
...@@ -269,7 +269,7 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -269,7 +269,7 @@ function defaultPrefilter( elem, props, opts ) {
// inline-level elements accept inline-block; // inline-level elements accept inline-block;
// block-level elements need to be inline with layout // block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block"; style.display = "inline-block";
} else { } else {
......
...@@ -16,7 +16,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca ...@@ -16,7 +16,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/, rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/, rtagName = /<([\w:]+)/,
rtbody = /<tbody/i, rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/, rhtml = /<|&#?\w+;/,
......
...@@ -221,7 +221,7 @@ jQuery.each({ ...@@ -221,7 +221,7 @@ jQuery.each({
ret = ret.reverse(); ret = ret.reverse();
} }
return this.pushStack( ret, name, slice.call( arguments ).join(",") ); return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
}; };
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment