Package cssutils :: Package stylesheets :: Module stylesheetlist |
[hide private]
[frames] | no frames]

# Source Code for Module cssutils.stylesheets.stylesheetlist

     1  """
     2  StyleSheetList implements DOM Level 2 Style Sheets StyleSheetList.
     3  """
     4  __all__ = ['StyleSheetList']
     5  __docformat__ = 'restructuredtext'
     6  __author__ = '$LastChangedBy: cthedot $'
     7  __date__ = '$LastChangedDate: 2007-08-20 22:01:52 +0200 (Mo, 20 Aug 2007) $'
     8  __version__ = '$LastChangedRevision: 256 $'
     9
    10 -class StyleSheetList(list):
    11      """
    12      Interface StyleSheetList (introduced in DOM Level 2)
    13
    14      The StyleSheetList interface provides the abstraction of an ordered
    15      collection of style sheets.
    16
    17      The items in the StyleSheetList are accessible via an integral index,
    18      starting from 0.
    19
    20      This Python implementation is based on a standard Python list so e.g.
    21      allows ``examplelist[index]`` usage.
    22      """
    23 -    def _getLength(self):
    24          return len(self)
    25
    26      length = property(_getLength,
    27          doc="""The number of StyleSheets in the list. The range of valid
    28          child stylesheet indices is 0 to length-1 inclusive.""")
    29
    30 -    def item(self, index):
    31          """
    32          Used to retrieve a style sheet by ordinal index. If index is
    33          greater than or equal to the number of style sheets in the list,
    34          this returns None.
    35          """
    36          try:
    37              return self[index]
    38          except IndexError:
    39              return None
    40