Package cssutils :: Package stylesheets :: Module medialist :: Class MediaList |
[hide private]
[frames] | no frames]

# Class MediaList

source code

      object --+
               |
       util.Base --+
                   |
      object --+   |
               |   |
    util.ListSeq --+
                   |
                  MediaList

Provides the abstraction of an ordered collection of media, without defining or constraining how this collection is implemented.

A media is always an instance of MediaQuery.

An empty list is the same as a list that contains the medium "all".

# Properties

length:
  The number of MediaQuery objects in the list.
mediaText: of type DOMString
  The parsable textual representation of this MediaList
self: a list (cssutils)
  All MediaQueries in this MediaList
wellformed:
  if this list is wellformed

# Format

    medium [ COMMA S* medium ]*

New:

    <media_query> [, <media_query> ]*

Nested Classes | [hide private]
Inherited from `util.Base` (private): `_prods`

Instance Methods | [hide private]
__init__(self, mediaText=None, readonly=False) unicodestring of parsable comma separared media or a list of media | source code
_getMediaText(self) returns serialized property mediaText | source code
_setMediaText(self, mediaText) simple value or comma-separated list of media | source code
__prepareset(self, newMedium) | source code
__setitem__(self, index, newMedium) overwrites ListSeq.__setitem__ | source code
appendMedium(self, newMedium) (DOM) Adds the medium newMedium to the end of the list. | source code
append(self, newMedium) overwrites ListSeq.append | source code
deleteMedium(self, oldMedium) (DOM) Deletes the medium indicated by oldMedium from the list. | source code
item(self, index) (DOM) Returns the mediaType of the index'th element in the list. | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
Inherited from `util.Base` (private): `_adddefaultproductions`, `_checkReadonly`, `_nexttoken`, `_parse`, `_splitNamespacesOff`, `_stringtokenvalue`, `_tokenize2`, `_tokensupto2`, `_tokenvalue`, `_type`, `_uritokenvalue`, `_valuestr` Inherited from `util.ListSeq`: `__contains__`, `__delitem__`, `__getitem__`, `__iter__`, `__len__` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Static Methods | [hide private]
Inherited from `util.Base` (private): `_normalize`

Class Variables | [hide private]
Inherited from `util.Base` (private): `_SHORTHANDPROPERTIES`, `_log`

Properties | [hide private]
| length (DOM readonly) The number of media in the list.
| mediaText (DOM) The parsable textual representation of the media list.
| wellformed
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, mediaText=None, readonly=False) (Constructor) | source code
mediaText unicodestring of parsable comma separared media or a list of media Overrides: object.__init__

### _setMediaText(self, mediaText) | source code
mediaText simple value or comma-separated list of media DOMException SYNTAX_ERR: (MediaQuery) Raised if the specified string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this media list is readonly.

### __setitem__(self, index, newMedium) (Index assignment operator) | source code
overwrites ListSeq.__setitem__ Any duplicate items are not removed. Overrides: util.ListSeq.__setitem__

### appendMedium(self, newMedium) | source code
(DOM) Adds the medium newMedium to the end of the list. If the newMedium is already used, it is first removed. newMedium a string or a MediaQuery object returns if newMedium is wellformed DOMException INVALID_CHARACTER_ERR: (self) If the medium contains characters that are invalid in the underlying style language. NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this list is readonly.

### append(self, newMedium) | source code
overwrites ListSeq.append Overrides: util.ListSeq.append

### deleteMedium(self, oldMedium) | source code
(DOM) Deletes the medium indicated by oldMedium from the list. DOMException NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this list is readonly. NOT_FOUND_ERR: (self) Raised if oldMedium is not in the list.

### item(self, index) | source code
(DOM) Returns the mediaType of the index'th element in the list. If index is greater than or equal to the number of media in the list, returns None.

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

Property Details | [hide private]

### length (DOM readonly) The number of media in the list. Get Method: unreachable(self)

### mediaText (DOM) The parsable textual representation of the media list. This is a comma-separated list of media. Get Method: _getMediaText(self) - returns serialized property mediaText Set Method: _setMediaText(self, mediaText) - simple value or comma-separated list of media

### wellformed Get Method: unreachable(self)