[Journal - The Doom of the DOM]

The Doom of the DOM

Sunday, September 12, 2004

IE has an interesting way of interpreting anchor elements (used for creating document fragment link targets) when it builds up the DOM:

<a name="foo" />           <!-- DOM-wise:               -->
<p>                        <!-- <a> <p> #Text </p> </a> -->
The tail of foo ...
</p>

<a name="bar"></a>         <!-- DOM-wise:               -->
<p>                        <!-- <a/> <p> #Text </p>     -->
Once upon a bar ...
</p>

There shouldn't be a semantic difference between the two examples. I run into this bug when I tweaked the Page Collapsing feature of the site. But maybe it's not a bug, but some workarround for compatibility's sake. Yes I know, I rely on IE's weird ways myself, much too much.

Update (Monday, January 30, 2006): A related bug appears in Firefox, in that styles defined for a elements are applied to the paragraphs following the anchor.

I've started writing about the new language features in Whidbey.