New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make jQuery.isNumeric consistent #2662

Closed
timmywil opened this Issue Oct 18, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@timmywil
Member

timmywil commented Oct 18, 2015

Some people understand isNumeric as, "can I do math on this thing?" Others are asking, "Is this actually a number?" Now that we have no internal usage of jQuery.isNumeric, I think we can choose one or the other and update the documentation. Right now, it is inconsistent and a confusing confluence of the two.

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Oct 18, 2015

Member

@dmethvin, @gibson042 and I propose allowing all input and returning true for strings and numbers – whether primitive or object – that can be numeric.

Member

timmywil commented Oct 18, 2015

@dmethvin, @gibson042 and I propose allowing all input and returning true for strings and numbers – whether primitive or object – that can be numeric.

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Oct 18, 2015

Member
jQuery.isNumeric = function( input ) {
  var type = jQuery.type( input );
  return ( type === "number" || type === "string" ) && ( input - parseFloat( input ) + 1 ) >= 0;
};
Member

timmywil commented Oct 18, 2015

jQuery.isNumeric = function( input ) {
  var type = jQuery.type( input );
  return ( type === "number" || type === "string" ) && ( input - parseFloat( input ) + 1 ) >= 0;
};

timmywil added a commit to timmywil/jquery that referenced this issue Oct 18, 2015

@timmywil timmywil self-assigned this Oct 18, 2015

@timmywil timmywil added this to the 3.0.0 milestone Oct 18, 2015

timmywil added a commit to timmywil/jquery that referenced this issue Oct 18, 2015

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Oct 20, 2015

Member

I added the behavior change tag since there's that one strange case with a custom .toString() that we will no longer handle. It can just be mentioned in the release notes.

Member

dmethvin commented Oct 20, 2015

I added the behavior change tag since there's that one strange case with a custom .toString() that we will no longer handle. It can just be mentioned in the release notes.

timmywil added a commit to timmywil/jquery that referenced this issue Oct 21, 2015

@timmywil timmywil closed this in #2663 Oct 21, 2015

timmywil added a commit that referenced this issue Oct 25, 2015

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.