Browser DOM trouble

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);">










This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s