targetsheet documentation


Style hyperlink elements with window targetting behavior based on their semantic 'rel' and sub-semantic 'class' attributes.

AKA sneak 'target' attributes past the validator.


Note: despite my use of the mischief-implying term 'sneak', there is nothing invalid (in letter or spirit) in this technique, in spite of how much certain well-respected fanatics[1] (as Mr. Glazman describes[2]) may object.

I shall quote a couple of sentences from the intro of the W3C Proposed Recommendation DOM Level 2 HTML[3].

"The transitional or frameset DTD for HTML 4.01, or the XHTML 1.0 DTDs are assumed. "


"The interfaces in this specification are designed for [HTML 4.01] documents, as well as for [XHTML 1.0] documents."

Essentially, this means first, that the HTML DOM applies to all HTML4/XHTML1 documents, independent of document type (note complete lack of any mention of document types in the second sentence that I quoted from the spec).

Second, it means that the interfaces defined therein assume, and thus provide access to, the functionality defined by the transitional or frameset DTDs.

Therefore it can be expected that the properties defined (which reflect the attributes defined by the transitional and frameset DTDs) in the HTML DOM apply to and are supported by all HTML4.01 and XHTML1.0 documents, regardless of their particular document type.

Some might say that this is a loophole, but if so, it is so huge and obvious, that it is far more likely intentional (perhaps well negotiated) design rather than an accidental side-effect.


'links' collection:
'className' property
'target' property
'rel' property


Since this hyperlink window targeting behavior is purely presentational, I would much rather write something like this in a style sheet:, { target:'z' window above }
 :link.local,:visited.local { target:current }
 :visited:not([rel='bookmark']):not(.plink) { target:'lockon' window above }

The advantage that using CSS over scripting would provide is the ability to override the presentation via the cascade. Many users prefer that all hyperlinks open in the current window, and never open a new window.

If CSS properties were used to determine the presentation of hyperlinks rather than scripting (or markup for that matter), then the abovementioned users could place a rule in their user style sheet to always override the author's suggested presentation:

 :link,:visited { target-position:current ! important }

The 'target' shorthand property (and its implied individual properties) are currently being discussed by certain troublemakers as one way to encourage the separation of linking presentation from linking semantics, a heretofore unsolved problem at W3C.


  1. [1]
  2. [2]
  3. [3]

Tantek Çelik - 20021121