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: 2008-01-03 21:47:28 +0100 (Do, 03 Jan 2008) $'
     8  __version__ = '$LastChangedRevision: 798 $'
     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 item(self, index):
    24          """
    25          Used to retrieve a style sheet by ordinal index. If index is
    26          greater than or equal to the number of style sheets in the list,
    27          this returns None.
    28          """
    29          try:
    30              return self[index]
    31          except IndexError:
    32              return None
    33
    34      length = property(lambda self: len(self),
    35          doc="""The number of StyleSheets in the list. The range of valid
    36          child stylesheet indices is 0 to length-1 inclusive.""")
    37