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

Class CSSImportRule

source code

 object --+        
          |        
  util.Base --+    
              |    
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

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.
media: of type stylesheets::MediaList (DOM readonly)
A list of media types for this rule of type MediaList.
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).

Currently always None

cssutils only

atkeyword:
the literal keyword used
hreftype: 'uri' (serializer default) or 'string'
The original usage of href, not really relevant as it may be configured in the serializer too

Inherits properties from CSSRule

Format

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


Nested Classes [hide private]

Inherited from util.Base (private): _ttypes

Instance Methods [hide private]
 
__init__(self, href=None, mediaText=u'all', hreftype=None, readonly=False)
if readonly allows setting of properties in constructor only
source code
 
_getHref(self)
returns href as a string
source code
 
_setHref(self, href)
parse properly
source code
 
_getMedia(self)
returns MediaList
source code
 
_getStyleSheet(self)
returns a CSSStyleSheet or None
source code
 
_getCssText(self)
returns serialized property cssText
source code
 
_setCssText(self, cssText)
DOMException on setting
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code

Inherited from cssrule.CSSRule (private): _getTypeString

Inherited from util.Base (private): _checkReadonly, _tokenize, _tokensupto, _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]
  type = 3
The type of this rule, as defined by a CSSRule type constant.

Inherited from cssrule.CSSRule: FONT_FACE_RULE, UNKNOWN_RULE

Inherited from cssrule.CSSRule (private): _typestrings

Inherited from util.Base (private): _log

Properties [hide private]
  href
Location of the style sheet to be imported.
  media
(DOM readonly) A list of media types for this rule of type MediaList
  styleSheet
(readonly) The style sheet referred to by this rule.
  cssText
(DOM attribute) The parsable textual representation.

Inherited from cssrule.CSSRule: typeString

Inherited from object: __class__

Method Details [hide private]

__init__(self, href=None, mediaText=u'all', hreftype=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
hreftype
'uri' (default) or 'string'
Overrides: cssrule.CSSRule.__init__

_setHref(self, href)

source code 
TODO:
parse properly

DOMException on setting

  • SYNTAX_ERR: (not checked here) Raised if the specified CSS string value has a syntax error and is unparsable.
  • NO_MODIFICATION_ALLOWED_ERR: (CSSRule) Raised if this rule is readonly.

_getCssText(self)

source code 
returns serialized property cssText
Overrides: cssrule.CSSRule._getCssText

_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

__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]

href

Location of the style sheet to be imported.
Get Method:
cssutils.css.cssimportrule.CSSImportRule._getHref(self) - returns href as a string
Set Method:
cssutils.css.cssimportrule.CSSImportRule._setHref(self, href) - parse properly
Delete Method:
None

media

(DOM readonly) A list of media types for this rule of type MediaList
Get Method:
cssutils.css.cssimportrule.CSSImportRule._getMedia(self) - returns MediaList
Set Method:
None
Delete Method:
None

styleSheet

(readonly) The style sheet referred to by this rule.
Get Method:
cssutils.css.cssimportrule.CSSImportRule._getStyleSheet(self) - returns a CSSStyleSheet or None
Set Method:
None
Delete Method:
None

cssText

(DOM attribute) The parsable textual representation.
Get Method:
cssutils.css.cssimportrule.CSSImportRule._getCssText(self) - returns serialized property cssText
Set Method:
cssutils.css.cssimportrule.CSSImportRule._setCssText(self, cssText) - DOMException on setting
Delete Method:
None