W3C home > Mailing lists > Public > www-style@w3.org > July 2011

Re: [Selectors4] case-insensitive attribute value matching (in XML)

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Mon, 25 Jul 2011 16:16:06 +0200
Message-Id: <3A4C5B1F-BB38-49C4-B577-DA04FAE9514A@crissov.de>
To: CSS WG <www-style@w3.org>
Anne van Kesteren:

> […] the attribute value needs to be matched ASCII case-insensitively […]
> Authors might want that ability too in case they write CSS against "unknown" markup.
> 
>  [att=/val/i]
>  [att=val flag]
>  [att=ascii-case-insensitive(val)]

We currently have the following attribute selectors:

  [att]      – ‘att’ set, even with an empty value

  [att=val]  – ‘att’ text value equals ‘val’
  [att|=val] – ‘att’ text value equals ‘val’ or begins with ‘val-’
             = [att=val],[att^=val-]
  [att^=val] – ‘att’ text value begins with ‘val’
  [att$=val] – ‘att’ text value ends with ‘val’
  [att*=val] – ‘att’ text value contains ‘val’ at least once, {1,}

  [att~=val] – ‘att’ space-separated list value includes item ‘val’ 

Also, “case-sensitivity of attribute names in selectors depends on the document language.” The spec doesn’t seem to say whether value strings are to be normalized (to NFC or whatever). 

We might want several variants to enable case-sensitive, case-insensitive, ASCII case-insensitive and language dependent case-insensitive matching, perhaps more. The solution should work with ‘=’, ‘^=’, ‘$=’ and ‘*=’ at least. I suggest a single character in front of the equals sign, e.g.:

  [att==val] – ‘att’ text value equals ‘val’ case-sensitive
               also ‘^==’, ‘$==’, ‘*==’ etc.
  [att'=val] – ‘att’ text value equals ‘val’ case-insensitive
               also ‘^'=’, ‘$'=’, ‘*'=’ etc.
  [att`=val] – ‘att’ text value equals ‘val’ ASCII case-insensitive
               also ‘^`=’, ‘$`=’, ‘*`=’ etc.

If apostrophe ‘'’ does not work, because it starts a string, I propose instead:

  [att==val] – ‘att’ text value equals ‘val’ case-sensitive
  [att:=val] – ‘att’ text value equals ‘val’ case-insensitive
  [att;=val] – ‘att’ text value equals ‘val’ ASCII case-insensitive
Received on Monday, 25 July 2011 14:16:36 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:42 GMT