Package cssutils :: Package css :: Module selector :: Class Selector |
[hide private]
[frames] | no frames]

# Class Selector

source code

    object --+
             |
     util.Base --+
                 |
                Selector

(cssutils) a single selector in a SelectorList of a CSSStyleRule

# Properties

selectorText
  textual representation of this Selector
prefixes
  a set which prefixes have been used in this selector
seq
  sequence of Selector parts including comments
wellformed
  if this selector is wellformed regarding the Selector spec

# Format

    # implemented in SelectorList
    selectors_group
      : selector [ COMMA S* selector ]*
      ;

    selector
      : simple_selector_sequence [ combinator simple_selector_sequence ]*
      ;

    combinator
      /* combinators can be surrounded by white space */
      : PLUS S* | GREATER S* | TILDE S* | S+
      ;

    simple_selector_sequence
      : [ type_selector | universal ]
        [ HASH | class | attrib | pseudo | negation ]*
      | [ HASH | class | attrib | pseudo | negation ]+
      ;

    type_selector
      : [ namespace_prefix ]? element_name
      ;

    namespace_prefix
      : [ IDENT | '*' ]? '|'
      ;

    element_name
      : IDENT
      ;

    universal
      : [ namespace_prefix ]? '*'
      ;

    class
      : '.' IDENT
      ;

    attrib
      : '[' S* [ namespace_prefix ]? IDENT S*
            [ [ PREFIXMATCH |
                SUFFIXMATCH |
                SUBSTRINGMATCH |
                '=' |
                INCLUDES |
                DASHMATCH ] S* [ IDENT | STRING ] S*
            ]? ']'
      ;

    pseudo
      /* '::' starts a pseudo-element, ':' a pseudo-class */
      /* Exceptions: :first-line, :first-letter, :before and :after. */
      /* Note that pseudo-elements are restricted to one per selector and */
      /* occur only in the last simple_selector_sequence. */
      : ':' ':'? [ IDENT | functional_pseudo ]
      ;

    functional_pseudo
      : FUNCTION S* expression ')'
      ;

    expression
      /* In CSS3, the expressions are identifiers, strings, */
      /* or of the form "an+b" */
      : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
      ;

    negation
      : NOT S* negation_arg S* ')'
      ;

    negation_arg
      : type_selector | universal | HASH | class | attrib | pseudo
      ;

Nested Classes | [hide private]
Inherited from `util.Base` (private): `_prods`

Instance Methods | [hide private]
__init__(self, selectorText=None, readonly=False) initial value of this selector | source code
_getSelectorText(self) returns serialized format | source code
_setSelectorText(self, selectorText) sets this selectorText | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
Inherited from `util.Base` (private): `_checkReadonly`, `_getProductions`, `_newseq`, `_nexttoken`, `_parse`, `_tokenize2`, `_tokensupto2`, `_tokenvalue`, `_type`, `_valuestr` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Static Methods | [hide private]
Inherited from `util.Base` (private): `_normalize`

Class Variables | [hide private]
Inherited from `util.Base` (private): `_SHORTHANDPROPERTIES`, `_log`

Properties | [hide private]
| selectorText (DOM) The parsable textual representation of the selector.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, selectorText=None, readonly=False) (Constructor) | source code
selectorText initial value of this selector readonly default to False Overrides: object.__init__

### _setSelectorText(self, selectorText) | source code
sets this selectorText TODO: raises xml.dom.Exception

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

Property Details | [hide private]

  ### selectorText (DOM) The parsable textual representation of the selector. Get Method: cssutils.css.selector.Selector._getSelectorText(self) - returns serialized format Set Method: cssutils.css.selector.Selector._setSelectorText(self, selectorText) - sets this selectorText Delete Method:
      None