W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

Re: [selectors-api] Handling :link and :visited Pseudo Classes

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Thu, 17 Apr 2008 09:24:38 +0200
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: public-webapi <public-webapi@w3.org>
Message-ID: <ontd04l7nsatvnhchbrrpnq09919nt8jmg@hive.bjoern.hoehrmann.de>

* Boris Zbarsky wrote:
>So it sounds to me like neither :link nor :visited match anything.  But someone 
>who actually has the beta (or can look at the code, of course) should check: the 
>white-paper is vague enough it could mean other things too, and IE8b1 doesn't 
>always match the white-papers.

After some quick tests I am not sure what it does or is supposed to do.
As a simple example, I made two links <a href='...'><span>...</span></a>
one visited, one unvisited. 

  document.querySelectorAll(":link");      // returned zero elements
  document.querySelectorAll(":visited");   // returned zero elements
  document.querySelectorAll(":link *");    // returned two elements
  document.querySelectorAll(":link span"); // returned two elements
  document.querySelectorAll(":visited *"); // returned zero elements

My original assumption was actually that it treats both selectors as if
it would not support them at all, except that it does not throw on their
use (that would require all calls to return zero and having :not() to
tell that and matching no elements at all, but it turns out :not() is
not supported).

So from these results it would seem :visited never matches anything and
:link matches all links except when it is the subject of the selector in
which case it matches nothing. That seems contrary to the documentation.

As for the suggestion that all links must match one or the other, that
would disallow e.g. reporting accurate results for all "visible" links
but omitting any invisble link. I don't think that should be disallowed.

(As an aside, IE8 throws if the selector argument has trailing white
space, but does not if it's leading white space instead. A quick reading
of css3-selectors suggests white space on either end is illegal).
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Thursday, 17 April 2008 07:25:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:10:00 UTC