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

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 UTC