Skip to content
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

isDigit/digit-parser true with empty string #88

Closed
Raigen opened this issue Jun 5, 2012 · 2 comments
Closed

isDigit/digit-parser true with empty string #88

Raigen opened this issue Jun 5, 2012 · 2 comments
Labels

Comments

@Raigen
Copy link

Raigen commented Jun 5, 2012

And me again. I work hard on my tablesorter implementation today :)

I added an own parser for input:checkbox elements and tried to use the is-method for the parser, but it never came to it. Then I looked where it ends and I found the digit-parser will always return true. isDigit is using the following regex /^[\-+(]?\d*[)]?$/. If I test this regex with an empty string it will return true.

/^[\-+(]?\d*[)]?$/.test('');

The cell with only an input-tag inside will have an empty string as text, so the digit-parser will be applied to that column.
If I replace the * with a + it will not stop at the digit-parser and my parser will be noticed and applied.
/^[\-+(]?\d+[)]?$/
I do not know if this will break something else but I guess not.

@Mottie
Copy link
Owner

Mottie commented Jun 5, 2012

Thanks again!... I'll look to see if this fix breaks anything :)

@Mottie
Copy link
Owner

Mottie commented Jun 7, 2012

It's not breaking anything so far, so I'll include this in the next update. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants