This has represented a few hours of my life. At the present moment I don't know if the bug lies in firefox, the web developer extension or the firebug extension.
I'm using Firefox 3.0.13 under Kubuntu Linux (9.04) with the Web Developer extension v. 1.1.8 and the FireBug extension v. 1.4.3.
Consider the following small HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FireFox a name ul bug</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<a name="comments"/>
<ul id="comments_list">
<li>
<div>
<a href="void" >TEST</a>
</div>
</li>
</ul>
</body>
</html>
Using the http://validator.w3.org it validates.
Opening the page in firefox and viewing the source yields the HTML above, as one would expect. What threw me for quote some time however is that if you do a "select all" on the page and right click -> view selection source you get:
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>FireFox a name ul bug</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<a name="comments">
</a><ul id="comments_list">
<a name="comments"> </a><li>
<a name="comments"> </a><div>
<a name="comments"> </a><a href="void">TEST</a>
</div>
</li>
</ul>
</body></html>
As you can see there are now three erroneous <a name="comments"> interspersed between various tags. The same behavior happens under FireBug if you inspect the element.
If you change the <a name="comments"/> to <a name="comments"></a> and repeat the select all view selection source experiment it yields:
Which is correct. Since the page validates using the <a name="foo" /> notation, it seems to me it should not trash the DOM.
To see the bug in action, here's a test page.
At the present moment, my formVista blogging software does not support anonymous comments. If you would like to comment on this article please register for an account using the register link in the upper left corner.