in Javascript

childNodes problem in FF !!!

I was working with js and got a peculiar problem (it’s was unknown to me 😛 😀 🙁 ) about childNodes count in firefox and opera. Internet explorer showed perfectly. suppose my html is like
[sourcecode language=’css’]

  • One
  • Two

[/sourcecode]
Now the js:
[sourcecode language=’css’]
objFather = document.getElementById(‘ul_id’); //get the father ul’ ID
arrayChildren = objFather.childNodes; //geting array of children
childNum = arrayChildren.length;
[/sourcecode]

Here childNum will give diff values for diff browser. FF, Opera counts the whitespaces . textnodes as child but IE is normal in this case.

Usefull link: One