View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Björn Höhrmann > CSS-SAC-0.08 > CSS::SAC::Selector



Annotate this POD


New  5
Open  3
View/Report Bugs
Module Version: 0.03   Source  


CSS::SAC::Selector - base class for SAC selectors


  use CSS::SAC::Selector qw(:constants);
  foo if $sel->is_type(SELECTOR_TYPE_CONSTANT);


SAC Selectors describe selectors that can be expressed in CSS such as ElementSelector or SiblingSelector. This class provides everything that is needed to implement simple selectors (methods, constants) as well as what is needed by subclasses defining more complex selectors.

The constants are those defined in the SAC spec, with the leading SAC_ removed. What the constants map to is to be considered an opaque token that can be tested for equality. If there is demand for it, I will add a way to add new constants (for people wishing to define new condition types).

I have also added the UNKNOWN_SELECTOR constant. It shouldn't occur in normal processing but it's always useful to have such fallback values.

The Selector interface adds $sel->is_type($selector_type) to the interface defined in the SAC spec. This allows for more flexible type checking. The advantages are the same as those described for the same extension in the CSS::SAC::Condition class.




Robin Berjon <>

This module is licensed under the same terms as Perl itself.

syntax highlighting: