Closed Bug 193584 Opened 23 years ago Closed 23 years ago

Images included in hyperlinks with text are underlined in valid pages

Categories

(Core :: Layout: Block and Inline, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: Robert.Bamler, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3b) Gecko/20030210 Build Identifier: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3b) Gecko/20030210 Hyperlinks that contain images *and* text are underlined by default: <a href="index.htm"><img src="image.gif" alt="image" />text</a> Here both, the image and the text are underlined. Hyperlinks that contain only an image are not underlined: <a href="index.htm"><img src="image.gif" alt="image" /></a> Here the image is not underlined. This bug appears only in valid HTML pages with a doctype-definition. (Tested with <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">) Webpages without a doctype-definition are displayed correctly (ie. the images are not underlined). Reproducible: Always Steps to Reproduce: 1. Create a webpage with the following sourcecode: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> </head> <body> Link with image and text:<br /> <a href="doesnotexist.htm"><img src="http://www.mozilla.org/start/1.0/images/mozillaLogo.png" alt="image" />Text</a><br /> The image is underlined in Mozilla 1.3b.<br /><br /> Link with image only:<br /> <a href="doesnotexist.htm"><img src="http://www.mozilla.org/start/1.0/images/mozillaLogo.png" alt="image" /></a><br /> The image is notunderlined in Mozilla 1.3b. </body> </html> 2. Display this webpage in Mozilla 1.3b (Build ID: 2003021008) Actual Results: The displayed page contains two links. Each link contains one image. The first image is underlined, the second image is not underlined. Expected Results: None of the two images should be underlined.
<a> elements have "text-decoration:underline" in the Mozilla UA stylesheet. This means that they should be underlined, so we underline them (in quirks mode, we implement a broken underlining model for backwards compat). I'd think the bug here is that the image which has no text to it is not underlined....
But it is impossible to turn off underlining the image with a markup like this: <a href="index.htm"><img src="image.gif" alt="image" style="text-decoration:none" />text</a> You can only disable underlining for the whole link. Is that the correct behaviour?
Yes, that is the correct behavior (since the _image_ is not underlined to start with -- the <a> is what's underlined, and changing style on the image should not affect that per spec).
1.2b-based K-Meleon 0.7 renders the first image in the given example without underlining, whereas 1.3b adds underlining. IE6, Netscape 4.78 and Opera 6.05 (my other browsers) do it the 1.2b-way. So: is this an advancement in standards conformance or "just a bug"?
The former. See bug 1777 for relevant discussion and patches. Note that the given example includes an XML declaration, which makes IE and opera show it in their "backwards compatibility" modes (because IE has a bug in its doctype parsing and Opera is copying IE). So testing on the given example is useless in any case.
An element with no text in it should not get affected by text-decoration, so even that case is correct. INVALID per comments.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
*** Bug 226467 has been marked as a duplicate of this bug. ***
*** Bug 302030 has been marked as a duplicate of this bug. ***
*** Bug 328392 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.