Re: :target pseudo-class vs. XPointer

Hi,

   I tried to finde some appropriate changes to deal with XPointers and
made some other corrections, but see below.

Re-worded section in the selectors module:

  6.6.2 The target pseudo-class :target

  URI references may contain additional reference information,
  identifying a certain portion of the resource. These URI references
  end with a number sign followed by an identifier for this portion
  (called the fragment identifier).

  For instance in HTML, fragment identifiers refer to a certain element
  in the document. The following URI reference points to an anchor named
  'march2001' in an HTML document:

    http://www.example.org/news.html#march2001

  The indentified portion can be selected using the :target
  pseudo-class:

    p.note:target

  selects a 'p' element of class 'note' that is the target element of
  the referring URI reference.

  CSS examples of use of the :target pseudo-class:

    *:target { border: thin dotted red }
    *:target::before { content: url(target.png) }

  Support for this selector may be limited to the level of support of
  the fragment identification mechanism.

Changes include:

  * defused the definition of what a fragment identifier refers to to
    consider the case of XPointers that refer to several
    locations/fragments/etc.

  * changed 'URI' to 'URI reference' (if it has a fragment identifier,
    it's a URI reference, not n URI, see RFC 2396 for the definition)

  * unquoted 'number sign', it's the official Unicode name for the
    character, quoting seems to be inappropriate

  * changed the example URI (having a 'html' directory doesn't really
    make sense, 'top.html' implies a badly named frame and underscores
    are ugly)

  * example => examples

  * at the same level of specifity, authors should always specify fore-
    and background-color, hence the 'color: red' declaration was changed
    to use the border property

  * added note on limited support; if an implementation does not support
    XPointers, it cannot support :target for XPointers. For example,
    implementations may only support a subset of XPointers (typically
    the abbreviated form #id for the XPointer #xpointer(id('id'))).

I am no XPointer expert, but I remember it should be possible to define
XPointers that select e.g text spanning across multiple elements, e.g.

  <p>...<em>...</em>...</p>
      ^^^^^^^^

Using :target we can select this weired fragment, but CSS3 selectors are
supposed to select something that makes a box in the rendering model,
hence we would have some overlapping boxes here (em, p, :target). Hmm,
wait, :target is a pseudo-class, the abbreviated form :target really is

  *|*:target

thus only a subset of XPointers could be used in combination with
:target, i.e. only XPointers that select element node sets, thus we
won't have the problem of overlapping boxes here. I think this is not
intended, since Chris Lilley explicitly mentions substring selection in
his reply to [1]. What to do about it?

  * restrict :target to element node sets
  * modify semantics of type/universal selectors in :target context
  * chose some other representation for this selector, i.e. some new
    syntax magic like or an at-rule like

      @target { border: solid thick blue }

[1] http://lists.w3.org/Archives/Public/www-style/2001Apr/0100.html

regards,
-- 
Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/

Received on Thursday, 18 October 2001 23:00:54 UTC