Package cssutils :: Package css :: Module selectorlist :: Class SelectorList
[hide private]
[frames] | no frames]

Class SelectorList

source code

  object --+    
           |    
   util.Base --+
               |
  object --+   |
           |   |
util.ListSeq --+
               |
              SelectorList

(cssutils) a list of Selectors of a CSSStyleRule

Properties

length: of type unsigned long, readonly
The number of Selector elements in the list.
parentRule: of type CSSRule, readonly
The CSS rule that contains this selector list or None if this list is not attached to a CSSRule.
selectorText: of type DOMString
The textual representation of the selector for the rule set. The implementation may have stripped out insignificant whitespace while parsing the selector.
seq: (internal use!)
A list of Selector objects
wellformed
if this selectorlist is wellformed regarding the Selector spec
Nested Classes [hide private]

Inherited from util.Base (private): _prods

Instance Methods [hide private]
 
__init__(self, selectorText=None, parentRule=None, readonly=False)
initializes SelectorList with optional selectorText
source code
 
__prepareset(self, newSelector, namespaces=None)
used by appendSelector and __setitem__
source code
 
__setitem__(self, index, newSelector)
overwrites ListSeq.__setitem__
source code
 
append(self, newSelector)
overwrites ListSeq.append
source code
 
__getNamespaces(self)
uses children namespaces if not attached to a sheet, else the sheet's ones
source code
 
_getSelectorText(self)
returns serialized format
source code
 
_setSelectorText(self, selectorText) source code
 
appendSelector(self, newSelector)
Append newSelector (a string will be converted to a new Selector).
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
_getUsedUris(self)
used by CSSStyleSheet to check if @namespace rules are needed
source code

Inherited from util.ListSeq: __contains__, __delitem__, __getitem__, __iter__, __len__

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]
  length
The number of Selector elements in the list.
  _namespaces
if this SelectorList is attached to a CSSStyleSheet the namespaces of that sheet are mirrored here.
  parentRule
(DOM) The CSS rule that contains this SelectorList or None if this SelectorList is not attached to a CSSRule.
  selectorText
(cssutils) The textual representation of the selector for a rule set.

Inherited from object: __class__

Method Details [hide private]

__init__(self, selectorText=None, parentRule=None, readonly=False)
(Constructor)

source code 
initializes SelectorList with optional selectorText
Parameters:
  • selectorText - parsable list of Selectors
  • parentRule - the parent CSSRule if available
Overrides: object.__init__

__setitem__(self, index, newSelector)
(Index assignment operator)

source code 

overwrites ListSeq.__setitem__

Any duplicate Selectors are not removed.

Overrides: util.ListSeq.__setitem__

append(self, newSelector)

source code 
overwrites ListSeq.append
Overrides: util.ListSeq.append

_setSelectorText(self, selectorText)

source code 
Parameters:
  • selectorText - comma-separated list of selectors or a tuple of (selectorText, dict-of-namespaces)
Raises:
  • NAMESPACE_ERR - (Selector) Raised if the specified selector uses an unknown namespace prefix.
  • SYNTAX_ERR - (self) Raised if the specified CSS string value has a syntax error and is unparsable.
  • NO_MODIFICATION_ALLOWED_ERR - (self) Raised if this rule is readonly.

appendSelector(self, newSelector)

source code 
Append newSelector (a string will be converted to a new Selector).
Parameters:
  • newSelector - comma-separated list of selectors or a tuple of (selectorText, dict-of-namespaces)
Returns:
New Selector or None if newSelector is not wellformed.
Raises:
  • NAMESPACE_ERR - (self) Raised if the specified selector uses an unknown namespace prefix.
  • SYNTAX_ERR - (self) Raised if the specified CSS string value has a syntax error and is unparsable.
  • NO_MODIFICATION_ALLOWED_ERR - (self) Raised if this rule is readonly.

__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]

length

The number of Selector elements in the list.
Get Method:
unreachable(self)

_namespaces

if this SelectorList is attached to a CSSStyleSheet the namespaces of that sheet are mirrored here. While the SelectorList (or parentRule(s) are not attached the namespaces of all children Selectors are used.
Get Method:
__getNamespaces(self) - uses children namespaces if not attached to a sheet, else the sheet's ones

parentRule

(DOM) The CSS rule that contains this SelectorList or None if this SelectorList is not attached to a CSSRule.
Get Method:
unreachable(self)

selectorText

(cssutils) The textual representation of the selector for a rule set.
Get Method:
_getSelectorText(self) - returns serialized format
Set Method:
_setSelectorText(self, selectorText)