-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
+var
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
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
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
+ core_push = Array.prototype.push,
+ core_slice = Array.prototype.slice,
+ core_indexOf = Array.prototype.indexOf,
+ core_toString = Object.prototype.toString,
+ core_hasOwn = Object.prototype.hasOwnProperty,
+ core_trim = String.prototype.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
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)
rootjQuery,
- // 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\-]*)$)/,
+ // The deferred used on DOM ready
+ readyList,
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
+ // For matching the engine and version of the browser
+ browserMatch,
- // Used for trimming whitespace
+ // Used for detecting and trimming whitespace
+ core_rnotwhite = /\S/,
+ core_rspace = /\s+/,
trimLeft = /^\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
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
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,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
// Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
// Matches dashed string for camelizing
- rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
// Keep a UserAgent string for use with jQuery.browser
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
DOMContentLoaded = function() {
if ( document.addEventListener ) {
},
toArray: function() {
- return slice.call( this );
+ return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
+ core_push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
},
slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
+ return this.pushStack( core_slice.apply( this, arguments ),
+ "slice", core_slice.call(arguments).join(",") );
},
map: function( callback ) {
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
- push: push,
+ push: core_push,
sort: [].sort,
splice: [].splice
};
type: function( obj ) {
return obj == null ?
String( obj ) :
- class2type[ toString.call(obj) ] || "object";
+ class2type[ core_toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
try {
// Not own constructor property must be Object
if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
var key;
for ( key in obj ) {}
- return key === undefined || hasOwn.call( obj, key );
+ return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
+ if ( data && core_rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
},
// Use native String.trim function wherever possible
- trim: trim ?
+ trim: core_trim ?
function( text ) {
return text == null ?
"" :
- trim.call( text );
+ core_trim.call( text );
} :
// Otherwise use our own trimming functionality
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
+ core_push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
var len;
if ( array ) {
- if ( indexOf ) {
- return indexOf.call( array, elem, i );
+ if ( core_indexOf ) {
+ return core_indexOf.call( array, elem, i );
}
len = array.length;
}
// Simulated bind
- var args = slice.call( arguments, 2 ),
+ var args = core_slice.call( arguments, 2 ),
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
}
// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
+if ( core_rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}