Closed Bug 632389 Opened 12 years ago Closed 12 years ago

Renders <p> outside of its enclosing <a>

Categories

(Core :: DOM: HTML Parser, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: christofer, Unassigned)

References

()

Details

(Whiteboard: [fixed by the HTML5 parser])

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; sv-se) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

The page is rendered with php and the source code always looks correct. But sometimes Firefox renders one <p> outside of its enclosing <a> and adding additional <a> tags. Reloading the page will make the page render correctly most of the time.

Screenshot: https://img.skitch.com/20110208-rt5g7pt9jr7b9wfkewh6g1m9n7.jpg


Reproducible: Sometimes

Steps to Reproduce:
1. Visit the URL
2. Brows the categories until the bug appears. It might take some time. 
Actual Results:  
The <p> is rendered outside if its enclosing <a> and additional <a> tags are rendered


This is what firebug display when the bug occurs:

<li>
	<a href="?content=47486">
		<img src="http://thomascook.streamingbolaget.se/resources/118522-SID_Mat_och_dryck.jpg" onerror="this.src='images/fallback.png'">
			<span class="rating">

			</span>
			<span class="arrow">▴</span>
	</a><p><a href="?content=47486">Mat och dryck</a></p>
<a href="?content=47486">							</a>
</li>

--

This is what the source looks like:

<li >
	<a href="?content=47486">
		<img onerror="this.src='images/fallback.png'"  src="http://thomascook.streamingbolaget.se/resources/118522-SID_Mat_och_dryck.jpg" />
		<span class="rating">

		</span>
		<span class="arrow">&#9652;</span>
		<p>Mat och dryck</p>

	</a>
</li>
<a><p> </p></a> is invalid markup per HTML4 spec (block element p inside inline element a not allowed). 
Please test with Fx 4 beta (new HTML5 parser implemented).
Component: General → HTML: Parser
Product: Firefox → Core
QA Contact: general → parser
This is a known bug in the old HTML parser, fixed in the HTML5 parser.
Whiteboard: DUPEME
I didn't find a bug to dupe this against quickly enough.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: DUPEME → [fixed by the HTML5 parser]
Is there any way to work around this until Fx 4 is released?
Don't use invalid markup?
http://validator.w3.org/
(In reply to comment #4)
> Is there any way to work around this until Fx 4 is released?

I'm not aware of workarounds.

(In reply to comment #5)
> Don't use invalid markup?
> http://validator.w3.org/

It's valid HTML5.
You need to log in before you can comment on or make changes to this bug.