Re: Numeric constants vs enumerated strings

On Thu, 16 Feb 2012 09:57:54 +0100, Anne van Kesteren <annevk@opera.com>  
wrote:

> On Thu, 16 Feb 2012 08:58:05 +0100, Philip Jägenstedt  
> <philipj@opera.com> wrote:
>> Can't we have our cake and eat it too? If we really want to favor  
>> consistency on the scripting side (not implementation), we could let  
>> HTMLMediaElement.readyState and XMLHttpRequest.readyState return magic  
>> objects that compare true both to their string and their numeric  
>> constants. It might have to toString to the number, though...
>
> That sounds somewhat messy.
>
> In any event, Document.readyState already returns a string (and not even  
> because we designed it that way, because it so happened to be in  
> Microsoft's implementation), so the inconsistency is already there.

OK, in that case it sounds fine to just have a property called  
"readyState" and let it return strings, as renaming it to just "state"  
wouldn't actually help consistency.

-- 
Philip Jägenstedt
Core Developer
Opera Software

Received on Thursday, 16 February 2012 19:36:09 UTC