Closed Bug 491789 Opened 12 years ago Closed 11 years ago

block tags <div><p><h4> nested in an <a> tag cause CSS problem

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 324875

People

(Reporter: mmbee888, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)

When nested <div>, <p>, <h3>, <h4> or <h5> in an <a> tag, firefox reproduces duplicate <a> tag with empty space. Weird. 

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
h3, h4, h5 {padding:0; margin:0;}
.results { }
	.results li {margin:0; padding:0; list-style:none;}
	.results a {width:100%; display:block; margin:0 0 6px 0; }
	.results a:hover { text-decoration:none; background:#EBEFFA; cursor:pointer;}
	.results div {padding:5px;}
	.results h1 { border-bottom:2px solid #FFFFFF; font-size:19px; font-weight:normal; margin:0pt 0pt 0px; padding-bottom:10px; width:auto; }
	.results h3 { color:#0000cc; font-size:17px; font-weight:normal; text-decoration:underline; margin-bottom:1px; line-height:18px;}
	.results h4 { padding:0; margin:0; font-size:13px; line-height:16px; font-weight:normal; }
	.results h5 { color:#008B00; padding:1px 0 2px 0; font-size:13px; font-weight:normal;}
</style>
</head>

<body>
<ul class="results">
    <li class="clearfix">
    <a target="_blank" href="http://www.mozilla.org">
        <div>
        <h3>test</h3>
        <h4>description</h4>
        <h5>detail...</h5>
        </div>
    </a>
    </li>
        <li class="clearfix">
    <a target="_blank" href="http://www.mozilla.org">
        <div>
        <h3>test</h3>
        <h4>description</h4>
        <h5>detail...</h5>
        </div>
    </a>
    </li>
        <li class="clearfix">
    <a target="_blank" href="http://www.mozilla.org">
        <div>
        <h3>test</h3>
        <h4>description</h4>
        <h5>detail...</h5>
        </div>
    </a>
    </li>
        <li class="clearfix">
    <a target="_blank" href="http://www.mozilla.org">
        <div>
        <h3>test</h3>
        <h4>description</h4>
        <h5>detail...</h5>
        </div>
    </a>
    </li>
        <li class="clearfix">
    <a target="_blank" href="http://www.mozilla.org">
        <div>
        <h3>test</h3>
        <h4>description</h4>
        <h5>detail...</h5>
        </div>
    </a>
    </li>
</ul>

</body>
</html>


Reproducible: Sometimes
I've reproduced exactly the same behavior with

<li>
<a display:block>
<some_block_elements/>
</a>
</li>
I am getting the same result with:

<a>
   <span></span>
   <div></div>
   <h2></h2>
   <h4></h4>
   <p></p>
</a>

Refreshing the page renders the correct html. Can only reproduce sometimes. FF 3.5.7 on OS X.
Component: General → HTML: Parser
Product: Firefox → Core
QA Contact: general → parser
This is going to get fixed with the html5 parser.
Depends on: html5-parsing
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 324875
You need to log in before you can comment on or make changes to this bug.