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

Travis Leithead wrote:
>>> document.links doesn't return <area>, <link>, <svg:a>, etc. document.links
> also doesn't allow selectors like
>>>   :link > span, :visited > span
> 
> Again, correct, but couldn't that be simplified to:
> a > span

Not quite.  For example:

   <a name="foo"><span></span></a>

That <span> matches "a > span" but not ":link > span".

> BTW, .links does include areas. <link> cannot be navigated per se.

For what it's worth, it can in some UAs, assuming the styles on it are changed 
to make it not be display:none.

One other point here, which is related to Anne's point about <svg:a>, is that 
document.links only exists in HTML documents.  Should you have an SVG document, 
or MathML, or anything else that's not (X)HTML, you can't use document.links. 
I'm not sure how much of a concern this is in IE at the moment, but if you have 
plans for native SVG or MathML support going forward it would make sense to not 
get authors relying on a behavior you're likely to want to change.

I appreciate your stance on the security issue here, but it seems to me like 
making all links match :link and none of them match :visited would give you the 
same security benefits while giving a much more useful tool to web developers. 
If there's a security issue there which I'm missing, can you please point it out?

-Boris

Received on Wednesday, 16 April 2008 21:28:10 UTC