CSS Selector with Descendant combinator with <a href="..."> tag do not apply the right style

RESOLVED INVALID

Status

()

Firefox
General
RESOLVED INVALID
10 years ago
10 years ago

People

(Reporter: Thomas, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

I think there is a bug in css selector when using Descendant combinator with <a href="...">  tag.

When the href attribute is filled with a full address (http://...) the wrong style is selected. When href attribute is filled with relative address or "#" the right style is selected.

You can find bellow the HTML code to reproduce the bug :

<html>
<head>
	<title>test</title>
	<style type="text/css">
		a:link, a:visited{
		color:#00ff00;
		text-decoration:none;
		}
		
		.class1 a:link, a:visited{
			color:#ff0000;
			text-decoration:none;
		}
	</style>
</head>
<body>

<div class="class1">
	<a href="/">This link should be red</a><br />
	<a href="http://127.0.0.1/">This link should be red</a>
</div>
	
<br /><br />

<a href="http://127.0.0.1/">This link should be Green but is Red</a><br />
<a href="/">This link should be Green</a>
<br>
The reason seams to be the value of "href"
</body>
</html>

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

Comment 1

10 years ago
You probably want 
.class1 a:link, .class1 a:visited
instead of
.class1 a:link, a:visited
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

10 years ago
thanks

but I think that changing the link in the href attribute change the style could be considered as a bug
You need to log in before you can comment on or make changes to this bug.