Closed Bug 146702 Opened 22 years ago Closed 22 years ago

a:hover style incorrectly applied to elements after an empty <a/> element

Categories

(Core :: DOM: HTML Parser, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: heycam, Assigned: dbaron)

References

()

Details

- Occurs on Mozilla 1.0rc3 (build 2002052309).
- Does not occur on Mozilla 0.9.9 (build 20020412).

If a style is given for either a:hover or a:active, and there exists an empty
anchor element (such as <a name="blah"/>), the text afterwards has the a:hover
style applied to it on mouse over.  The empty <a> element must be closed in the
XML way -- <a name="blah"/>.  The SGML style empty element <a name="blah"></a>
does not exhibit the problem.

At the URL mentioned above is an example of this.  The text in the <p> element
will have the a:hover style (color: red) applied to it when the mouse hovers
over it.  Similarly, when the mouse button is pressed, the a:active style
(font-weight: bold) is applied to it.

The style sheet used is at http://www-personal.monash.edu.au/~cameron/mozbug/a.css .
XHTML served as text/html is handled by the HTML parser, which (intentionally) 
does not support XMLisms. If you wish to use XML empty-tags, serve your document 
as application/xml+xhtml (ideally) or another suitable XML MIME-type.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Component: Style System → Parser
Resolution: --- → INVALID
<foo /> in HTML doesn't mean the same as in XHTML. In HTML it is a SHORTTAG
form. Specifically, <foo/.../ is the same as <foo>...</foo> in HTML.

-> VERIFIED INVALID.
Status: RESOLVED → VERIFIED
OK.  But how do I get Mozilla to render XHTML pages?  I tried giving it a MIME 
type of application/xhtml+xml (which seems to be the appropriate one), but it 
just renders it as it does all XML documents without a stylesheet (i.e., just 
stringifies the whole document).
application/xhtml+xml will work; text/xml is the preferred MIME type though.

Either way, you are missing the mandatory namespace declaration in your document.
All XHTML documents must start with:

   <html xmlns="http://www.w3.org/1999/xhtml">

That is how XML processors know that the document is XHTML.

See http://www.mozillaquestquest.com/ for an example of an XHTML site.
You need to log in before you can comment on or make changes to this bug.