Question : IE error only, object doesn't support this property or method

Hi there,

I'm traversing through the DOM and trying to filter out specific types of tags not to work off of.  So I have this array defining my list.  

tagArray = ['A', 'APPLET', 'BODY', 'H1', 'H2', 'H3', 'HEAD', 'HR', 'IMG', 'INPUT', 'META', 'SCRIPT', 'SELECT', 'TEXTAREA'];

And then later on I do this condition
if(currentElementChild.nodeType === 3 && (tagArray.indexOf(currentElementChild.parentNode.tagName) === -1)) {
}

This works in safari, chrome firefox and probably opera but IE is throwing a object doesn't support this property or method error.  I have checked in console of IE and tagArray exists and so does currentElementChild and its parentNode and tag name and they also sometimes are -1 in the IE console too.  

Any idea aside from IE being terrible why this doesnt work?

Answer : IE error only, object doesn't support this property or method

You may use something like this :

http://www.w3schools.com/jsref/jsref_isNaN.asp
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
tagArray = [];
tagArray['A']=0;
tagArray['APPLET']=1;
tagArray['BODY']=2;
tagArray['H1']=3;
tagArray['H2']=4;
tagArray['H3']=5;
tagArray['HEAD']=6;
tagArray['HR']=7;
tagArray['IMG']=8;
tagArray['INPUT']=9;
tagArray['META']=10;
tagArray['SCRIPT']=11;
tagArray['SELECT']=12;
tagArray['TEXTAREA']=13;
if(currentElementChild.nodeType === 3 && !isNaN(tagArray[currentElementChild.parentNode.tagName.toUpperCase()]) ) {
//
}
Random Solutions  
 
programming4us programming4us