Closed
Bug 360286
Opened 19 years ago
Closed 19 years ago
parseInt will try to parse an octal when the string begins with a 0
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mva.led, Unassigned)
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy)
This is documented in http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:parseInt
However, it says "this feature is deprecated".
Besides, ECMAScript does not state so.
Reproducible: Always
Steps to Reproduce:
Test this HTML in Firefox 2:
<html>
<body>
<script type="text/javascript">
document.write(Array( parseInt("07"), parseInt("08"), parseInt("09")));
</script>
</body>
</html>
Actual Results:
7,0,0
Expected Results:
7,8,9
Comment 1•19 years ago
|
||
Invalid.
<http://bclary.com/2004/11/07/#a-15.1.2.2>
12. If the length of S is at least 1 and the first character of S is "0", then at the implementation's discretion either let R = 8 or leave R unchanged.
14. If S contains any character that is not a radix- R digit, then let Z be the substring of S consisting of all characters before the first such character; otherwise, let Z be S.
Both Firefox and MSIE agree on parseInt('07'), parseInt('08') and parseInt('09').
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•19 years ago
|
||
Opss, I missed that part of the spec. Sorry.
You need to log in
before you can comment on or make changes to this bug.
Description
•