Last Comment Bug 645786 - a:visited selector ignores text-decoration: line-through style
: a:visited selector ignores text-decoration: line-through style
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: unspecified
: x86 Windows XP
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
: 680318 768772 768773 (view as bug list)
Depends on:
Blocks: 147777
  Show dependency treegraph
Reported: 2011-03-28 11:56 PDT by Shane Beasley
Modified: 2012-06-26 22:38 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Shane Beasley 2011-03-28 11:56:09 PDT
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:

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;
<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 class="visited">span-visited</span>
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.
Comment 1 User image j.j. 2011-03-28 12:14:22 PDT
That's intended, see bug 147777
Comment 2 User image Boris Zbarsky [:bz] (still a bit busy) 2011-03-28 12:23:41 PDT
Indeed.  See also
Comment 3 User image Shane Beasley 2011-03-28 17:06:54 PDT
Okay, so I've seen three documents:

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?

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;

[Slightly off-topic: Is there any dispensation for disabling this feature globally or on a per-site basis (e.g. with Greasemonkey)?]
Comment 4 User image Shane Beasley 2011-03-28 17:14:47 PDT
Oh, and also this link, which seems to be the official documentation on this feature:
Comment 5 User image Boris Zbarsky [:bz] (still a bit busy) 2011-03-28 18:07:37 PDT
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...
Comment 6 User image Shane Beasley 2011-03-28 19:00:21 PDT

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. :)
Comment 7 User image Boris Zbarsky [:bz] (still a bit busy) 2011-03-28 19:38:37 PDT
David, is it worth adding some sort of accessibility workaround for this?
Comment 8 User image Shane Beasley 2011-03-28 20:12:44 PDT
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.
Comment 9 User image Boris Zbarsky [:bz] (still a bit busy) 2011-03-28 20:28:25 PDT
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.
Comment 10 User image j.j. 2011-08-19 02:46:19 PDT
*** Bug 680318 has been marked as a duplicate of this bug. ***
Comment 11 User image Mardeg 2012-06-26 22:12:34 PDT
*** Bug 768772 has been marked as a duplicate of this bug. ***
Comment 12 User image Mardeg 2012-06-26 22:38:06 PDT
*** Bug 768773 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.