shorthand closed anchor element slurps in later content




13 years ago
13 years ago


(Reporter: Zane Rockenbaugh, Unassigned)


Firefox Tracking Flags

(Not tracked)





13 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

Using a shorthand closed anchor element (e.g., "<a href="foo" />) erroneously
slurps in later content, making the a part of the link. I found this while
trying to use generated content (using CSS) to create the links and later
content would show up as part of the link. It looks like's it's generating a new
element box because if you create a :before pseudo-element in the CSS, it gets
applied to the later text as well (see

Interposing another anchor element makes things act correctly. This is
demonstrated in

Reproducible: Always

Steps to Reproduce:
Go to provided URL
Actual Results:  
Page mis-rendered.

Expected Results:  
See (which uses a non-shorthand anchor

Comment 1

13 years ago
The example page is being sent as text/html, so this is correct behaviour (in so
much as you aren't closing the tag). Please send the pages as an XML MIME format
if you want XML parsing to occur.

Comment 2

13 years ago
Changing the contexnt type to "application/xhtml+xml" does not fix problem; see I have checked with both the latest
released versions of Firefox and Mozilla; both mis-render the page and report
the content type as application/xhtml+xml.

Comment 3

13 years ago
That file is still being sent as text/html and Gecko (Moz/FF) are still treating
it as HTML only.

Do not forget that <meta> tags are trumped by HTTP headers, and since we have an
HTTP Content-Type header of text/html (to be precice, it is sending
"Content-Type: text/html; charset=ISO-8859-1")...

Comment 4

13 years ago
"View Selection Source" can be used to see what the parser is creating.  In this
case the input of:

<a href="" />

<a href="">
</a><div><a href="">Foo</a></div>

(residual-style here is reopening the anchor tag because the <div> cannot be nested)

This is correct behavior.  Marking invalid.
Last Resolved: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.