Setting background-color in an 'a:visited' rule doesn't work

RESOLVED WONTFIX

Status

()

Core
CSS Parsing and Computation
RESOLVED WONTFIX
6 years ago
6 years ago

People

(Reporter: mjh563, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

401 bytes, text/html
Details
(Reporter)

Description

6 years ago
Created attachment 633771 [details]
testcase

The attached testcase sets the color of a ':visited' link to red and the background color to yellow. However, only the text color is applied.

Fails: Firefox 14, Chrome

Works as expected: Firefox 3.6.28, Opera 12
(Reporter)

Updated

6 years ago
Attachment #633771 - Attachment mime type: text/plain → text/html
This is expected behavior due to http://dbaron.org/mozilla/visited-privacy

In particular, you're using a solid color for a:visited and a transparent background for unvisited links.  The relevant part of the document linked above is:

   If the relevant link is visited, it returns a color whose R (red), G (green), and B
   (blue) components come from the second style context (the style-if-visited) but whose A
   (alpha) component comes from the first.

And the unvisited style has an alpha of 0, so you get a transparent background.

Which is to say, you should be explicitly specifying backgrounds for unvisited links if you want links to have backgrounds...
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
(Reporter)

Comment 2

6 years ago
OK, thanks. I wasn't aware of that particular aspect of the :visited history leak fix. As you say, it works if the unvisited link has an explicit (non-transparent) background color set.
Yeah... unfortunately, different alpha values for the two colors are subject to timing attacks, hence the restriction here.
Duplicate of this bug: 767173
You need to log in before you can comment on or make changes to this bug.