shorthand closed anchor element slurps in later content

RESOLVED INVALID

Status

()

Firefox
General
RESOLVED INVALID
13 years ago
13 years ago

People

(Reporter: Zane Rockenbaugh, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

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 http://www.zanecorp.com/bug/index4.html).

Interposing another anchor element makes things act correctly. This is
demonstrated in http://www.zanecorp.com/bug/index3.html.

Reproducible: Always

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

Expected Results:  
See http://www.zanecorp.com/bug/index2.html (which uses a non-shorthand anchor
element).

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.
(Reporter)

Comment 2

13 years ago
Changing the contexnt type to "application/xhtml+xml" does not fix problem; see
http://www.zanecorp.com/bug/index4.html. 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="http://www.mozilla.org" />
<div>Foo</div>

becomes:
<a href="http://www.mozilla.org">
</a><div><a href="http://www.mozilla.org">Foo</a></div>

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

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