Opened 6 years ago

Closed 6 years ago

#15192 closed bug (notabug)

Clean code

Reported by: David Gofman Owned by:
Priority: minor Milestone: none
Component: ui.core Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by Ryan J Ollos)

I am wondering why you are excluding === and !== validation from jshint.

When I am evaluating code by using jshint I am getting many warning:

Expected !== and instead saw !=.

One of critical issue in your core widget on line 35

https://github.com/jquery/jquery-ui/blob/master/ui/widget.js#L35

You are implemented for loop such as:

for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {

however ( elem = elems[ i ] ) will never will be null i most cases is "undefined"

If I will change to strong type such as:

for ( i = 0; ( elem = elems[ i ] ) !== null; i++ ) {

I will be in infinite loop and browser will be freezes.

I will suggest make changes and fix this loops as well either:

for ( i = 0; ( elem = elems[ i ] ) !== undefined; i++ ) 

or

for ( i = 0; !!( elem = elems[ i ] ); i++ )

to handle null and undefined

Thanks, David

Change History (3)

comment:2 Changed 6 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 6 years ago by Scott González

Resolution: notabug
Status: newclosed

Your coding standards differing from ours is not a bug.

Note: See TracTickets for help on using tickets.