Package cssutils :: Package css :: Module cssrulelist
[hide private]
[frames] | no frames]

Source Code for Module cssutils.css.cssrulelist

 1  """ 
 2  CSSRuleList implements DOM Level 2 CSS CSSRuleList. 
 3  """ 
 4  __all__ = ['CSSRuleList'] 
 5  __docformat__ = 'restructuredtext' 
 6  __author__ = '$LastChangedBy: doerwalter $' 
 7  __date__ = '$LastChangedDate: 2007-08-07 11:24:45 +0200 (Di, 07 Aug 2007) $' 
 8  __version__ = '0.9.2a1, $LastChangedRevision: 184 $' 
 9   
10   
11 -class CSSRuleList(list):
12 """ 13 The CSSRuleList interface provides the abstraction of an ordered 14 collection of CSS rules. 15 16 The items in the CSSRuleList are accessible via an integral index, 17 starting from 0. 18 19 Subclasses a standard Python list so all standard list methods are 20 available. 21 22 Properties 23 ========== 24 length: of type unsigned long, readonly 25 The number of CSSRules in the list. The range of valid child rule 26 indices is 0 to length-1 inclusive. 27 """ 28
29 - def _getLength(self):
30 return len(self)
31 32 length = property(_getLength, 33 doc="(DOM) The number of CSSRules in the list.") 34 35
36 - def item(self, index):
37 """ 38 (DOM) 39 Used to retrieve a CSS rule by ordinal index. The order in this 40 collection represents the order of the rules in the CSS style 41 sheet. If index is greater than or equal to the number of rules in 42 the list, this returns None. 43 44 Returns CSSRule, the style rule at the index position in the 45 CSSRuleList, or None if that is not a valid index. 46 """ 47 try: 48 return self[index] 49 except IndexError: 50 return None
51