Re: [CSS3][selectors] target pseudo, need some clarification

Thanks , Daniel,

But my question was not about ID or name - I know when and how to use ID/names

The question was marked by asterisks:
*the uri which was used for loading current document* ?

Definition in the spec is just silent about  what URI is used.
Someone may think that
a:target { color:white-satin; }
<a href="#foo" >...</a>
<a name="foo" >...</a>
second <a> will be rendered in white-satin.

Andrew Fedoniouk.
http://terrainformatica.com


----- Original Message ----- 
From: "Daniel Glazman" <daniel.glazman@disruptive-innovations.com>
|
| Andrew Fedoniouk wrote:
|
| > ...I am looking on this definition:
| > http://www.w3.org/TR/2000/WD-css3-selectors-20001005/#target-pseudo
| >
| > Am I correct in my assumption that :target matches all elements
| > in current loaded document having either ID or name attributes equal to
| > the target-id part of *the uri which was used for loading
| > current document* ?
|
| No, you're not.
|
| 1. it is illegal for an HTML document to have more than one element having the
|    same ID, that's SGML. Same thing for XHTML/XML.
| 2. the name attribute is a fragment identifier's target only on an anchor
|    element.
| 3. as per section 12.2 of HTML4, name and id attributes share the same
|    namespace (that's my very first contribution to the HTML 4 spec, during
|    an HTML WG face-to-face meeting in Sophia-Antipolis too many years ago)
|    and must be unique, together, in the scope of the document.
|
| Furthermore, browsers do not - because they cannot - target all elements
| matching URL's fragment identifier. In case of an invalid document having
| more than once the same ID or name attribute on an anchor, browsers target
| the first one found in traversal order of the document.
|
| </Daniel>
| 

Received on Friday, 28 October 2005 22:22:47 UTC