Package cssutils :: Package css :: Module cssimportrule :: Class CSSImportRule |
[hide private]
[frames] | no frames]

# Class CSSImportRule

source code

    object --+
             |
     util.Base --+
                 |
        util.Base2 --+
                     |
       cssrule.CSSRule --+
                         |
                        CSSImportRule

Represents an @import rule within a CSS style sheet. The @import rule is used to import style rules from other style sheets.

# Properties

atkeyword: (cssutils only)
  the literal keyword used
cssText: of type DOMString
  The parsable textual representation of this rule
href: of type DOMString, (DOM readonly, cssutils also writable)
  The location of the style sheet to be imported. The attribute will not contain the url(...) specifier around the URI.
hreftype: 'uri' (serializer default) or 'string' (cssutils only)
  The original type of href, not really relevant as it may be reconfigured in the serializer but it is kept anyway
media: of type stylesheets::MediaList (DOM readonly)
  A list of media types for this rule of type MediaList.
name:
  An optional name used for cascading
styleSheet: of type CSSStyleSheet (DOM readonly)
  The style sheet referred to by this rule. The value of this attribute is None if the style sheet has not yet been loaded or if it will not be loaded (e.g. if the stylesheet is for a media type not supported by the user agent).

Inherits properties from CSSRule

# Format

import
  : IMPORT_SYM S* [STRING|URI] S* [ medium [ COMMA S* medium]* ]? S* STRING? S* ';' S* ;

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

Instance Methods | [hide private]
__init__(self, href=None, mediaText=`u'``all``'`, name=None, parentRule=None, parentStyleSheet=None, readonly=False) if readonly allows setting of properties in constructor only | source code
_getCssText(self) returns serialized property cssText | source code
_setCssText(self, cssText) DOMException on setting | source code
_setHref(self, href) | source code
_setName(self, name) raises xml.dom.SyntaxErr if name is not a string | source code
__setStyleSheet(self) Read new CSSStyleSheet cssText from href using parentStyleSheet.href | source code
_getWellformed(self) depending if media is used at all | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
Inherited from `cssrule.CSSRule` (private): `_setAtkeyword` Inherited from `util.Base2` (private): `_adddefaultproductions`, `_setSeq`, `_tempSeq` Inherited from `util.Base` (private): `_checkReadonly`, `_nexttoken`, `_parse`, `_splitNamespacesOff`, `_stringtokenvalue`, `_tokenize2`, `_tokensupto2`, `_tokenvalue`, `_type`, `_uritokenvalue`, `_valuestr` 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 `cssrule.CSSRule`: `CHARSET_RULE`, `COMMENT`, `FONT_FACE_RULE`, `IMPORT_RULE`, `MEDIA_RULE`, `NAMESPACE_RULE`, `PAGE_RULE`, `STYLE_RULE`, `UNKNOWN_RULE` Inherited from `cssrule.CSSRule` (private): `_typestrings` Inherited from `util.Base` (private): `_SHORTHANDPROPERTIES`, `_log`

Properties | [hide private]
| type The type of this rule, as defined by a CSSRule type constant.
| _usemedia if self._media is used (or simply empty)
| cssText (DOM attribute) The parsable textual representation.
| href Location of the style sheet to be imported.
| media (DOM readonly) A list of media types for this rule of type MediaList
| name An optional name for the imported sheet
| styleSheet (readonly) The style sheet referred to by this rule.
| wellformed depending if media is used at all
Inherited from `cssrule.CSSRule`: `atkeyword`, `parentRule`, `parentStyleSheet`, `typeString` Inherited from `util.Base2`: `seq` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, href=None, mediaText=`u'``all``'`, name=None, parentRule=None, parentStyleSheet=None, readonly=False) (Constructor) | source code
if readonly allows setting of properties in constructor only Do not use as positional but as keyword attributes only! href location of the style sheet to be imported. mediaText A list of media types for which this style sheet may be used as a string Overrides: object.__init__

### _setCssText(self, cssText) | source code
DOMException on setting HIERARCHY_REQUEST_ERR: (CSSStylesheet) Raised if the rule cannot be inserted at this point in the style sheet. INVALID_MODIFICATION_ERR: (self) Raised if the specified CSS string value represents a different type of rule than the current one. NO_MODIFICATION_ALLOWED_ERR: (CSSRule) Raised if the rule is readonly. SYNTAX_ERR: (self) Raised if the specified CSS string value has a syntax error and is unparsable. Overrides: cssrule.CSSRule._setCssText

### __setStyleSheet(self) | source code
Read new CSSStyleSheet cssText from href using parentStyleSheet.href Indirectly called if setting `href`. In case of any error styleSheet is set to `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]

### type The type of this rule, as defined by a CSSRule type constant. Overwritten in derived classes. The expectation is that binding-specific casting methods can be used to cast down from an instance of the CSSRule interface to the specific derived interface implied by the type. (Casting not for this Python implementation I guess...) Get Method: unreachable(self)

### _usemedia if self._media is used (or simply empty) Get Method: unreachable(self)

### cssText (DOM attribute) The parsable textual representation. Get Method: _getCssText(self) - returns serialized property cssText Set Method: _setCssText(self, cssText) - DOMException on setting

### href Location of the style sheet to be imported. Get Method: unreachable(self) Set Method: _setHref(self, href)

### media (DOM readonly) A list of media types for this rule of type MediaList Get Method: unreachable(self)

### name An optional name for the imported sheet Get Method: unreachable(self) Set Method: _setName(self, name) - raises xml.dom.SyntaxErr if name is not a string

### styleSheet (readonly) The style sheet referred to by this rule. Get Method: unreachable(self)

### wellformed depending if media is used at all Get Method: _getWellformed(self) - depending if media is used at all