Skip to content

#11317: jQuery.ifNumeric #684

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

Closed
wants to merge 1 commit into from
Closed

#11317: jQuery.ifNumeric #684

wants to merge 1 commit into from

Conversation

gibson042
Copy link
Member

jQuery Size - compared to last make
  250296   (+112) jquery.js
   94242    (+24) jquery.min.js
   33451     (-3) jquery.min.js.gz

@dmethvin
Copy link
Member

I'm not a fan of adding another utility-ish function that people can bikeshed. We're already getting that with isNumeric itself, like people who want floating-point numbers to be excluded.

The two changes in .css() can be done independently, so I think you are cheating on the byte count! :)

Other opinions?

@@ -335,7 +334,7 @@ if ( !jQuery.support.opacity ) {
style.zoom = 1;

// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
if ( value >= 1 && !jQuery.trim( filter.replace( ralpha, "" ) ) ) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you read the complete discussion here: http://bugs.jquery.com/ticket/6652 or the original patch #416? The check for an empty string is very much intentional. PLEASE read tickets that are cited before making changes like this.

cc @gnarf37

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a matter of fact, I did read http://bugs.jquery.com/ticket/6652. And I also read the source for jQuery.trim, which always returns a string. The equality check may be intentional, but it is not necessary.

@rwaldron
Copy link
Member

-1

There is no discussion, no documentation and it appears to increase the API surface area for very little benefit. The API ifNumeric itself if awkward, intuitively, I would want that to accept an expression to be evaluated and a callback, but I'd be way wrong.

@gibson042
Copy link
Member Author

Regarding byte count: reverting the css.js work takes this change from -3 to +9. But I would exempt that from "cheating" because it is related code and would not have been analyzed otherwise. Also, I did say that the method came along with a reduction, not that it was solely responsible for one. ;)

Regarding the API: I'm not married to the name, although the best one is already taken.

@timmywil
Copy link
Member

This ticket has been closed: plugin.

@timmywil timmywil closed this Feb 14, 2012
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants