On Sun, May 1, 2011 at 3:38 PM, Ger Hobbelt <[email protected]> wrote:

> On Sun, May 1, 2011 at 3:13 PM, Steve Onnis <[email protected]>wrote:
>
>> Why don’t you use typeof(console.info) to make sure it is what you are
>> expecting
>>
>>
>> Compare to the old skool browser sniff (if it's UA X then we got B)
> indirect checks versus direct (does this bugger have method B?) checks
> regarding DOM access functions.
>

BTW: if I'd been 100% anal/paranoid about it, it would have been this check
instead:

typeof(console) !== 'undefined' && typeof(console.info) !== 'undefined'
&& typeof(console.info.apply) === 'function'

where the last part /probably/ would have been done as

&& typeof(console.info.apply) !== 'undefined'

Since there's already one object in there (console.info) which you can treat
as a function, I'd dial expectations down as far as "you either get
'undefined' out of typeof or some other crap" and code this with that
mindset in charge.


-- 
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
        http://www.hebbut.net/
mail:   [email protected]
mobile: +31-6-11 120 978
--------------------------------------------------

Reply via email to