Package cssutils :: Package css :: Module cssnamespacerule :: Class CSSNamespaceRule
[hide private]
[frames] | no frames]

Class CSSNamespaceRule

source code

 object --+        
          |        
  util.Base --+    
              |    
cssrule.CSSRule --+
                  |
                 CSSNamespaceRule

Represents an @namespace rule within a CSS style sheet.

The @namespace at-rule declares a namespace prefix and associates it with a given namespace (a string). This namespace prefix can then be used in namespace-qualified names such as those described in the Selectors Module [SELECT] or the Values and Units module [CSS3VAL].

Properties

cssText: of type DOMString
The parsable textual representation of this rule
namespaceURI: of type DOMString
The namespace URI (a simple string!) which is bound to the given prefix. If no prefix is set (CSSNamespaceRule.prefix=='') the namespace defined by namespaceURI is set as the default namespace.
prefix: of type DOMString
The prefix used in the stylesheet for the given CSSNamespaceRule.nsuri. If prefix is empty namespaceURI sets a default namespace for the stylesheet.

cssutils only

atkeyword:
the literal keyword used

Inherits properties from CSSRule

Format

namespace
: NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* ;
namespace_prefix
: IDENT ;
Nested Classes [hide private]

Inherited from util.Base (private): _prods

Instance Methods [hide private]
 
__init__(self, namespaceURI=None, prefix=None, cssText=None, parentRule=None, parentStyleSheet=None, readonly=False)
Do not use as positional but as keyword parameters only!
source code
 
_setNamespaceURI(self, namespaceURI)
DOMException on setting
source code
 
_setPrefix(self, prefix=None)
DOMException on setting
source code
 
_setParentStyleSheet(self, parentStyleSheet) 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 object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Static Methods [hide private]

Inherited from util.Base (private): _normalize

Class Variables [hide private]
  type = 7
The type of this rule, as defined by a CSSRule type constant.

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]
  namespaceURI
URI (string!) of the defined namespace.
  prefix
Prefix used for the defined namespace.
  parentStyleSheet
Containing CSSStyleSheet.
  cssText
(DOM attribute) The parsable textual representation.

Inherited from cssrule.CSSRule: parentRule, typeString

Inherited from object: __class__

Method Details [hide private]

__init__(self, namespaceURI=None, prefix=None, cssText=None, parentRule=None, parentStyleSheet=None, readonly=False)
(Constructor)

source code 

Do not use as positional but as keyword parameters only!

If readonly allows setting of properties in constructor only

format namespace:

: NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
;
Parameters:
  • namespaceURI - The namespace URI (a simple string!) which is bound to the given prefix. If no prefix is set (CSSNamespaceRule.prefix=='') the namespace defined by namespaceURI is set as the default namespace
  • prefix - The prefix used in the stylesheet for the given CSSNamespaceRule.uri.
  • cssText - if no namespaceURI is given cssText must be given to set a namespaceURI as this is readonly later on
  • parentStyleSheet - sheet where this rule belongs to
Overrides: object.__init__

_setNamespaceURI(self, namespaceURI)

source code 
DOMException on setting
Parameters:
  • namespaceURI - the initial value for this rules namespaceURI
Raises:
  • NO_MODIFICATION_ALLOWED_ERR - (CSSRule) Raised if this rule is readonly or a namespaceURI is already set in this rule.

_setPrefix(self, prefix=None)

source code 
DOMException on setting
Parameters:
  • prefix - the new prefix
Raises:
  • SYNTAX_ERR - (TODO) 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
Parameters:
  • cssText - initial value for this rules cssText which is parsed
Raises:
  • 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]

namespaceURI

URI (string!) of the defined namespace.
Get Method:
unreachable(self)
Set Method:
_setNamespaceURI(self, namespaceURI) - DOMException on setting

prefix

Prefix used for the defined namespace.
Get Method:
unreachable(self)
Set Method:
_setPrefix(self, prefix=None) - DOMException on setting

parentStyleSheet

Containing CSSStyleSheet.
Get Method:
unreachable(self)
Set Method:
_setParentStyleSheet(self, parentStyleSheet)

cssText

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