Closed Bug 976019 Opened 10 years ago Closed 10 years ago

The :link selector also affects :visited links.

Categories

(Core :: CSS Parsing and Computation, defect)

27 Branch
x86_64
Windows 8
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ruirize, Unassigned)

Details

Attachments

(1 file)

Attached image Screenshots of issue.
User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36

Steps to reproduce:

http://jsfiddle.net/L3Xw5/3/ (Click on the "Visited HREF" link to set test up correctly)

Attempted to style unvisited anchors with a background color of #f0f.


Actual results:

Both unvisited and visited anchors received this background color.


Expected results:

Only the unvisited anchor should receive it as per the W3 spec.
This is a security feature.  See http://dbaron.org/mozilla/visited-privacy which describes the restrictions on :link and :visited styling.  In particular, if a background color is only provided for one of :link and :visited, the :link style is used no matter whether hte link is visited or not, because otherwise you could detect which links are visited via timing attacks.

Here's what the specification says on the matter at <http://www.w3.org/TR/CSS21/selector.html#link-pseudo-classes>:

  UAs may therefore treat all links as unvisited links, or implement other measures to
  preserve the user's privacy while rendering visited and unvisited links differently.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: