Dabbling with a bit of web design this evening and was happily writting my XHTML 1.1 compliant page with a bit of standard JavaScript. I was developing this using IE7 and completed my little test. The test consisted of a DIV with three nested DIVs each containing their own specific elements. The JavaScript was supplied with the outer/parent DIV as an argument and would tell me how many childNodes it had, simple. Ran it in with IE and got 3, correct. Ran it in FireFox got 7, WHAT! Firefox counts *all* the descendants as children, surely this can’t be right? Oh well so much for "standards", no wonder web site design is such a pain in the padding-bottom!
Example snippet…
<div onclick="alert(this.childNodes.length);">
hello
<div></div>
<div>
<div></div>
<div></div>
<div></div>
</div>
<div></div>
</div>