[css-selectors] Non-String Attribute Selection

Hi,

Here’s a small proposal for inclusion in CSS Selectors 4 or 5: adding the possibility to consider attribute values as numbers instead of strings.

CSS:

    element[n:attribute<100] {    color: red;        }
    element[n:attribute=100] {    color: violet;    }
    element[n:attribute>100] {    color: blue;      }

HTML:

    <element attribute=”99” /> red
    <element attribute=”100” /> violet
    <element attribute=”100.0” /> violet
    <element attribute=”100.0px” /> violet
    <element attribute=”111” /> blue
    <element attribute=”string” /> inherit
    <element attribute=”” /> inherit
    <element /> inherit

And if the people here are in a good mood, we could maybe even add other types like dates (d:) and integers (i:). This new syntax ([cond:            ]) also opens the door to more condition types in a good-looking way, I think.

Have a nice Easter,
François

Received on Sunday, 8 April 2012 09:08:54 UTC