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

Composite pseudo classes

From: Pete Boere <pete@the-echoplex.net>
Date: Wed, 9 Nov 2011 12:15:16 +0000
Message-ID: <CAKZZz6cBPTMrfr7L6TUpvMkeRU3gLg=uF2WB+-eBFcikE9ah6g@mail.gmail.com>
To: www-style@w3.org
Usually when using the :hover pseudo class it is appropriate to also use
the :focus pseudo class for accesibility reasons. [1]

Is it possible to have composite pseudo classes for this purpose?
I've implemented a kind of composite pseduo class in a PHP CSS
preprocessor[2] like this:

..nav a:hocus { ... }
..nav a:pocus { ... }

compiling to

..nav a:hover, .nav a:focus { ... }
..nav a:hover, .nav a:focus, .nav a:active { ... }

internally a substitiution is being made using an :any (:matches) shim [3]
:hocus => :matches(:hover,:focus)


[1]
http://www.456bereastreet.com/archive/201004/whenever_you_use_hover_also_use_focus/
[2] http://the-echoplex.net/csscrush
[3]
https://github.com/peteboere/css-crush/blob/master/plugins/hocus-pocus.php

-- 
Pete Boere
Web Developer
Received on Wednesday, 9 November 2011 12:17:05 GMT

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