flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [2/2] git commit: [flex-falcon] [refs/heads/develop] - apparently, parseInt in JS should always specify the radix
Date Tue, 15 Mar 2016 20:52:56 GMT


On 3/15/16, 1:49 PM, "Alex Harui" <aharui@adobe.com> wrote:

>
>
>On 3/15/16, 1:35 PM, "Andy Dufilie" <andy.dufilie@gmail.com> wrote:
>
>>It's not a good idea to make built-in functions behave differently in JS
>>versus AS.
>>
>>It's not a required param in AS, and this change makes the following
>>evaluate to true in AS but false in the cross-compiled JS:
>>Number("0xFF00FF") == parseInt("0xFF00FF")
>
>Ah, good point.  I didn't think about that case.  So what do you suggest
>we do?  We could map it to a new org.apache.flex.utils.Language.parseInt
>that checks the string for a leading "0x" and calls JS parseInt with the
>right radix.   Or should we trust that all browsers we will actually use
>will "do the right thing"?

Actually, reading the MDN article again, maybe we should set the second
param to 0 instead of 10?

-Alex

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Ob
jects/parseInt

Mime
View raw message