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  Partly also 
 5      * http://dev.w3.org/csswg/cssom/#the-cssrulelist 
 6  """ 
 7  __all__ = ['CSSRuleList'] 
 8  __docformat__ = 'restructuredtext' 
 9  __author__ = '$LastChangedBy: cthedot $' 
10  __date__ = '$LastChangedDate: 2007-10-19 00:31:34 +0200 (Fr, 19 Okt 2007) $' 
11  __version__ = '$LastChangedRevision: 518 $' 
12   
13 -class CSSRuleList(list):
14 """ 15 The CSSRuleList object represents an (ordered) list of statements. 16 17 The items in the CSSRuleList are accessible via an integral index, 18 starting from 0. 19 20 Subclasses a standard Python list so all standard list methods are 21 available. 22 23 Properties 24 ========== 25 length: of type unsigned long, readonly 26 The number of CSSRules in the list. The range of valid child rule 27 indices is 0 to length-1 inclusive. 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 - def item(self, index):
36 """ 37 (DOM) 38 Used to retrieve a CSS rule by ordinal index. The order in this 39 collection represents the order of the rules in the CSS style 40 sheet. If index is greater than or equal to the number of rules in 41 the list, this returns None. 42 43 Returns CSSRule, the style rule at the index position in the 44 CSSRuleList, or None if that is not a valid index. 45 """ 46 try: 47 return self[index] 48 except IndexError: 49 return None
50