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  __version__ = '$Id: stylesheetlist.py 1116 2008-03-05 13:52:23Z cthedot $'
     7
     8 -class StyleSheetList(list):
     9      """
    10      Interface StyleSheetList (introduced in DOM Level 2)
    11
    12      The StyleSheetList interface provides the abstraction of an ordered
    13      collection of style sheets.
    14
    15      The items in the StyleSheetList are accessible via an integral index,
    16      starting from 0.
    17
    18      This Python implementation is based on a standard Python list so e.g.
    19      allows ``examplelist[index]`` usage.
    20      """
    21 -    def item(self, index):
    22          """
    23          Used to retrieve a style sheet by ordinal index. If index is
    24          greater than or equal to the number of style sheets in the list,
    25          this returns None.
    26          """
    27          try:
    28              return self[index]
    29          except IndexError:
    30              return None
    31
    32      length = property(lambda self: len(self),
    33          doc="""The number of StyleSheets in the list. The range of valid
    34          child stylesheet indices is 0 to length-1 inclusive.""")
    35