Closed Bug 645786 Opened 13 years ago Closed 13 years ago

a:visited selector ignores text-decoration: line-through style

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: sbeasley, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: 4.0

The a:visited selector ignores style text-decoration: line-through but not other styles (e.g. color: gray). Other selectors such as a.className or a:hover work fine.

Reproducible: Always

Steps to Reproduce:
Save this HTML file, then click on one of the "#" links to "visit" that URL:

<html>
<head>
<style>
a, span {
    font-weight: bold;
    color: inherit;
    cursor: default;
    text-decoration: underline;
}

a:visited, a.visited, span.visited {
    font-weight: normal;
    text-decoration: line-through;
    color: gray;
}

a:hover, span:hover {
    text-decoration: line-through;
}
</style>
</head>
<body>
<div>
<a href="about:blank">a(normal)</a>
<a href="#">a:visited</a>
<a href="about:blank" class="visited">a.visited</a>
<a href="#" class="visited">a.visited:visited</a>
<span>span</span>
<span class="visited">span-visited</span>
</div>
</body>
</html>
Actual Results:  
*.visited and a:visited are gray, and *.visited is decorated with line-through, but a:visited is decorated with underline.

Expected Results:  
Both *.visited and :visited should be decorated with line-through.

To rule out any interference from extensions, etc., I ran Firefox with an empty profile in my user temp folder like so:

"%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -no-remote -profile "%temp%\fxpfx"

The problem persists.
That's intended, see bug 147777
Whiteboard: dupme
Indeed.  See also http://dbaron.org/mozilla/visited-privacy
Blocks: 147777
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Whiteboard: dupme
Okay, so I've seen three documents:

http://dbaron.org/mozilla/visited-privacy
http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/
http://blog.mozilla.com/security/2010/03/31/plugging-the-css-history-leak/

They suggest that the CSS below, applied to comment 0, should give me visited links with backgrounds and borders, but I don't. Is that intentional?

<style>
a, span {
    border-bottom: 1px solid transparent;
    outline: 1px solid transparent;
}

a:visited, a.visited, span.visited {
    color: purple !important;
    background-color: yellow !important;
    border-bottom-color: purple !important;
    outline-color: purple !important;
}
</style>

[Slightly off-topic: Is there any dispensation for disabling this feature globally or on a per-site basis (e.g. with Greasemonkey)?]
Oh, and also this link, which seems to be the official documentation on this feature:

http://developer.mozilla.org/en/CSS/Privacy_and_the_%3Avisited_selector
The behavior on that testcase is expected, yes.  You can change _which_ color the border, outline, and background are, but you can't go from transparent to a color.  This is actually documented in the document you link to in comment 4:

  In addition, even for the properties you can set for visited links, you won't
  be able to change the transparency between unvisited and visited links

If you set background, border, and outline colors in that first rule, then the second rule will take effect.

> Is there any dispensation for disabling this feature

There is not, no...
-> VERIFIED INVALID

I saw the part about rgba/hsla but somehow skipped over "transparent." Oops.

By the way, I filed this in regards a client-side global style sheet that I apply to all sites because I usually find it difficult to distinguish between :link and :visited colors, hence why I'm upset that I'm left to distinguish between :link and :visited colors. :/

I'm disappointed, but not surprised. Anyway, thanks for putting up with me. :)
Status: RESOLVED → VERIFIED
David, is it worth adding some sort of accessibility workaround for this?
Oh, dear, what have I done... Although accessibility is definitely a good thing, I'm not sight-impaired myself (at least, I don't think I am). I just find that when I'm looking at a wall of text and graphics like a Google News or Reddit, it's easier to review unseen content if those links are markedly different from the others. <g>

Incidentally, I cobbled together a Greasemonkey script that colors links that I've clicked on the current page (with the middle button, i.e. in a new tab). Seems like that sort of thing will do for now, for my purposes.
Well, "accessibility" doesn't have to be sight-impairment issue.  Just "anything that makes it hard for someone to make sense of a page".  Which I think your use case certainly falls under, and I doubt you're the only one.  The question is whether we can meet it without leaking the contents of your history to random sites.
You need to log in before you can comment on or make changes to this bug.