aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2015-08-16 09:59:58 +0300
committerOleg Gaidarenko <markelog@gmail.com>2015-09-07 20:03:50 +0300
commit10fdad742a2a6aa9f0e00b3e04fc5264797c53c7 (patch)
tree6b6d7b1375ff88f4bebbfa0703f7b595eb485df9 /src/core.js
parent7aa46e0df8a673e6b00550bbbbed21eed50108b7 (diff)
downloadjquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.tar.gz
jquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.zip
Build: Update jscs and lint files
Fixes gh-2056
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/core.js b/src/core.js
index e8024aaf1..3fec8f1cb 100644
--- a/src/core.js
+++ b/src/core.js
@@ -1,4 +1,4 @@
-define([
+define( [
"./var/arr",
"./var/document",
"./var/slice",
@@ -16,6 +16,7 @@ var
// Define a local copy of jQuery
jQuery = function( selector, context ) {
+
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
@@ -35,6 +36,7 @@ var
};
jQuery.fn = jQuery.prototype = {
+
// The current version of jQuery being used
jquery: version,
@@ -79,9 +81,9 @@ jQuery.fn = jQuery.prototype = {
},
map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return this.pushStack( jQuery.map( this, function( elem, i ) {
return callback.call( elem, i, elem );
- }));
+ } ) );
},
slice: function() {
@@ -99,11 +101,11 @@ jQuery.fn = jQuery.prototype = {
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
- return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
},
end: function() {
- return this.prevObject || this.constructor(null);
+ return this.prevObject || this.constructor( null );
},
// For internal use only.
@@ -115,7 +117,7 @@ jQuery.fn = jQuery.prototype = {
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
+ target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
@@ -130,7 +132,7 @@ jQuery.extend = jQuery.fn.extend = function() {
}
// Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
target = {};
}
@@ -141,8 +143,10 @@ jQuery.extend = jQuery.fn.extend = function() {
}
for ( ; i < length; i++ ) {
+
// Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
+ if ( ( options = arguments[ i ] ) != null ) {
+
// Extend the base object
for ( name in options ) {
src = target[ name ];
@@ -154,15 +158,15 @@ jQuery.extend = jQuery.fn.extend = function() {
}
// Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) ||
- (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
+ ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
+ clone = src && jQuery.isArray( src ) ? src : [];
} else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
+ clone = src && jQuery.isPlainObject( src ) ? src : {};
}
// Never move original objects, clone them
@@ -180,7 +184,8 @@ jQuery.extend = jQuery.fn.extend = function() {
return target;
};
-jQuery.extend({
+jQuery.extend( {
+
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
@@ -194,7 +199,7 @@ jQuery.extend({
noop: function() {},
isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
+ return jQuery.type( obj ) === "function";
},
isArray: Array.isArray,
@@ -204,14 +209,16 @@ jQuery.extend({
},
isNumeric: function( obj ) {
+
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
- return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
+ return !jQuery.isArray( obj ) && ( obj - parseFloat( obj ) + 1 ) >= 0;
},
isPlainObject: function( obj ) {
+
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
@@ -242,9 +249,10 @@ jQuery.extend({
if ( obj == null ) {
return obj + "";
}
+
// Support: Android<4.0 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
- class2type[ toString.call(obj) ] || "object" :
+ class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
@@ -421,7 +429,7 @@ jQuery.extend({
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
-});
+} );
// JSHint would error on this code due to the Symbol not being defined in ES5.
// Defining this global in .jshintrc would create a danger of using the global
@@ -434,10 +442,10 @@ if ( typeof Symbol === "function" ) {
/* jshint ignore: end */
// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),
-function(i, name) {
+jQuery.each( "Boolean Number String Function Array Date RegExp Object Error".split( " " ),
+function( i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
+} );
function isArrayLike( obj ) {
@@ -457,4 +465,4 @@ function isArrayLike( obj ) {
}
return jQuery;
-});
+} );