Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

"rules": {
"import/extensions": [ "error", "always" ],
"import/no-cycle": "error"
"import/no-cycle": "error",
"indent": [ "error", "tab", {
"outerIIFEBody": 0
} ]
},

"overrides": [
Expand All @@ -23,7 +26,17 @@
"sourceType": "script"
},
"rules": {
"no-unused-vars": "off"
"no-unused-vars": "off",
"indent": [ "error", "tab", {

// Unlike other codes, "wrapper.js" is implemented in UMD.
// So it required a specific exception for jQuery's UMD
// Code Style. This makes that indentation check is not
// performed for 1 depth of outer FunctionExpressions
"ignoredNodes": [
"Program > ExpressionStatement > CallExpression > FunctionExpression > *"
]
} ]
},
"globals": {
"jQuery": false,
Expand Down
7 changes: 4 additions & 3 deletions src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var

// Anchor tag for parsing the document origin
originAnchor = document.createElement( "a" );
originAnchor.href = location.href;

originAnchor.href = location.href;

// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
Expand Down Expand Up @@ -426,8 +427,8 @@ jQuery.extend( {
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
jQuery( callbackContext ) :
jQuery.event,

// Deferreds
deferred = jQuery.Deferred(),
Expand Down
6 changes: 3 additions & 3 deletions src/ajax/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jQuery.ajaxSettings.xhr = function() {

var xhrSuccessStatus = {

// File protocol always yields status code 0, assume 200
0: 200
};
// File protocol always yields status code 0, assume 200
0: 200
};

jQuery.ajaxTransport( function( options ) {
var callback;
Expand Down
6 changes: 3 additions & 3 deletions src/attributes/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ jQuery.fn.extend( {
if ( this.setAttribute ) {
this.setAttribute( "class",
className || value === false ?
"" :
dataPriv.get( this, "__className__" ) || ""
"" :
dataPriv.get( this, "__className__" ) || ""
);
}
}
Expand All @@ -171,7 +171,7 @@ jQuery.fn.extend( {
while ( ( elem = this[ i++ ] ) ) {
if ( elem.nodeType === 1 &&
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
return true;
return true;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ jQuery.extend( {
if ( isArrayLike( Object( arr ) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
[ arr ] : arr
);
} else {
push.call( ret, arr );
Expand Down Expand Up @@ -407,9 +407,9 @@ if ( typeof Symbol === "function" ) {

// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( _i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function( _i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );

function isArrayLike( obj ) {

Expand Down
4 changes: 2 additions & 2 deletions src/core/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
for ( ; i < len; i++ ) {
fn(
elems[ i ], key, raw ?
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/nodeName.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function nodeName( elem, name ) {

return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();

};

Expand Down
8 changes: 4 additions & 4 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ jQuery.each( [ "height", "width" ], function( _i, dimension ) {
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, dimension, extra );
} ) :
getWidthOrHeight( elem, dimension, extra );
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, dimension, extra );
} ) :
getWidthOrHeight( elem, dimension, extra );
}
},

Expand Down
6 changes: 4 additions & 2 deletions src/deprecated/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jQuery.fn.extend( {
}
} );

jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
jQuery.each(
( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( _i, name ) {
Expand All @@ -39,4 +40,5 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
}
);
7 changes: 5 additions & 2 deletions src/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import "./css.js";

// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
jQuery.each( {
padding: "inner" + name,
content: type,
"": "outer" + name
}, function( defaultExtra, funcName ) {

// Margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
Expand Down
5 changes: 3 additions & 2 deletions src/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function Animation( elem, properties, options ) {
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
Expand Down Expand Up @@ -511,7 +511,8 @@ jQuery.fn.extend( {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;

doAnimation.finish = doAnimation;

return empty || optall.queue === false ?
this.each( doAnimation ) :
Expand Down
2 changes: 1 addition & 1 deletion src/effects/Tween.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Tween.propHooks = {
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 && (
jQuery.cssHooks[ tween.prop ] ||
jQuery.cssHooks[ tween.prop ] ||
tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ jQuery.event = {
event = jQuery.event.fix( nativeEvent ),

handlers = (
dataPriv.get( this, "events" ) || Object.create( null )
)[ event.type ] || [],
dataPriv.get( this, "events" ) || Object.create( null )
)[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};

// Use the fix-ed jQuery.Event rather than the (read-only) native event
Expand Down Expand Up @@ -416,12 +416,12 @@ jQuery.event = {
get: typeof hook === "function" ?
function() {
if ( this.originalEvent ) {
return hook( this.originalEvent );
return hook( this.originalEvent );
}
} :
function() {
if ( this.originalEvent ) {
return this.originalEvent[ name ];
return this.originalEvent[ name ];
}
},

Expand Down
4 changes: 1 addition & 3 deletions src/event/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ jQuery.extend( jQuery.event, {
special.bindType || type;

// jQuery handler
handle = (
dataPriv.get( cur, "events" ) || Object.create( null )
)[ event.type ] &&
handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
dataPriv.get( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
Expand Down
6 changes: 4 additions & 2 deletions src/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,11 @@ Expr = jQuery.expr = {
TAG: function( nodeNameSelector ) {
var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?

function() {
return true;
} :
return true;
} :

function( elem ) {
return nodeName( elem, expectedNodeName );
};
Expand Down
6 changes: 2 additions & 4 deletions src/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,14 @@ jQuery.fn.extend( {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
} )
.filter( function() {
} ).filter( function() {
var type = this.type;

// Use .is( ":disabled" ) so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) );
} )
.map( function( _i, elem ) {
} ).map( function( _i, elem ) {
var val = jQuery( this ).val();

if ( val == null ) {
Expand Down