Those aren't really elements, but text nodes, as they should be. HTML elements contain text nodes.
<p>text</p>
The paragraph
element doesn't hold an element, it holds a text node.
One thing I noticed, though, is that you have invalid markup and due to this, the DOM tree within Firefox is inconsistent with Chrome.
That text node for "As a commentor" should be a child of the paragraph, but the invalidness of the span
( owned by the paragraph ) containing the div
in Chrome is making it close the p
so the text node becomes a sibling. As the HTML parsers creates the tree, it reaches the <div>
and realizes that it's already within a p
and span
and a span
can't contain a div
so it closes the p
and creates a new element, the div
.
Firefox's DOM tree is lenient and actually allows the nesting to go on. This is the cause of the inconsistency of the placement of the text node which you're referring to.
Basically you have this:
<p><span><div>blah</div></span>As a commentor</p>
Chrome turns it into
<p><span></span></p><div>blah</div>As a commentor
Firefox lets it get away with it
<p><span><div>blah</div></span>As a commentor</p>
Solution: validate your HTML and don't let the span
contain the div
:
http://validator.w3.org/check?uri=http://gothamist.com/2010/07/18/wikileaks_founder_no-show_at_nyc_ha.php&charset=(detect+automatically)&doctype=Inline&group=0
After you properly mark it up, you'll see that the text node should live inside the p
.