I think the object type check is slightly better, because a primitive type 
would also have to check for the nodeType property, and would then throw an 
error than the property is undefined. This way, it tosses out primitive 
values before they are pointlessly checked for a "nodeType" property.

On Monday, October 31, 2011 11:11:05 AM UTC-4, Jake Verbaten wrote:
>
> The typeof context === 'object' is not needed, instead replace it with a 
> context != null check
>
> On Mon, Oct 31, 2011 at 2:35 PM, Timothy J. Warren <timw...@gmail.com>wrote:
>
>>
>> On Monday, October 31, 2011 9:56:22 AM UTC-4, Jake Verbaten wrote:
>>>
>>>
>>>
>>>>> IE doesn't have those constants defined - you need to use the numeric 
>>>>> value.
>>>>>
>>>>> http://stackoverflow.com/**quest**ions/1444650/how-does-**one-**
>>>>> access-the-node-type-**constants**-in-ie<http://stackoverflow.com/questions/1444650/how-does-one-access-the-node-type-constants-in-ie>
>>>>> -- 
>>>>>
>>>>
>>>> Does this apply to IE 8? Because that's my lowest target version. 
>>>>
>>>
>>> IE 8 does not have those constants but you can easily shim 
>>> it<https://github.com/Raynos/DOM-shim> alternatively 
>>> just use the number 1
>>>
>>
>> Okay, how does this look? 
>> http://dev.timshomepage.net/kis-js/src/core/core.js 
>>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to