#2783 closed defect (duplicate)
[CLA] dojo.number.parse fails for negative numbers in IE
Reported by: | Owned by: | Adam Peller | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Core | Version: | 0.9 |
Keywords: | Cc: | Adam Peller | |
Blocked By: | Blocking: |
Description
The 0.9 tests show that dojo.number.parse fails on negative numbers when running in IE. The cause of the problem is in the assumption that the RegExp? results array will return an undefined value for results[1] when parsing a negative number. However, in IE, the RegExp? returns an empty string in this situation. The problem can be solved by modifying the if statement in dojo.number.parse to look for empty strings as well.
Sorry I don't have a universal diff format, but here's how to apply the fix:
number.js; dojo.number.parse() Change:
if(typeof absoluteMatch == 'undefined'){
matched the negative pattern absoluteMatch = results[2]; info.factor *= -1;
}
To:
if(typeof absoluteMatch == 'undefined' absoluteMatch == ""){ matched the negative pattern absoluteMatch = results[2]; info.factor *= -1;
}
Submitted by: Michael Smith (msmith) [CLA, but don't have a trac account yet]
Change History (4)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Milestone: | → 0.9M2 |
---|---|
Owner: | changed from anonymous to Adam Peller |
Priority: | normal → high |
Reporter: | changed from guest to [email protected]… |
Whoops, I didn't mark the code as preformatted text. Here's another try:
number.js; dojo.number.parse()
Change:
To:
~msmith