Closed Bug 366623 Opened 19 years ago Closed 19 years ago

Elements not closing properly when using <.../>

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: wizofaus, Unassigned)

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Build Identifier: 1.5.0.9 Given the following HTML: <style> a { color: red;} </style> <a name="test" />Why is this text red? Firefox does not appear to recognise that the anchor tag is closed. Actually any A element with just a 'name' and no HREF shouldn't even need closing under pre-XHTML1.0. But even specifying XHTML 1.0 strict doesn't help here. The only way to avoid this is to use <a name="test"></a> It's not just a problem with A elements, BTW, it happens with everything. Reproducible: Always Steps to Reproduce: 1. Save above code into file 2. Load into browser Expected Results: Text should not be red.
If you serve XHTML as text/html, it's HTML with some extra attributes named "/" - that's why Appendix C tells you not to use <foo /> unless foo is an empty element in HTML. It's possible to write XHTML that survives treatment as text/html, but that doesn't change the rules for text/html: if you want application/xhtml+xml's parsing rules, you have to send application/xhtml+xml, with all that entails.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Yes, I read this elsewhere later. But a lot of sites do use this technique for named anchor tags, or don't close them at all, and they look fine in I.E. I suppose it's more an issue of being sensible about how to interpret a page with a missing close tag for a named anchor.
You need to log in before you can comment on or make changes to this bug.