isDigit/digit-parser true with empty string #88

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

Comments

Projects
None yet
2 participants

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.

Owner

Mottie commented Jun 5, 2012

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

Owner

Mottie commented Jun 7, 2012

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

@Mottie Mottie closed this Jun 21, 2012

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