CSS::DOM::Exception(3pm) User Contributed Perl Documentation CSS::DOM::Exception(3pm)NAME
CSS::DOM::Exception - The Exception interface for CSS::DOM
SYNOPSIS
use CSS::DOM::Exception 'SYNTAX_ERR';
eval {
die new CSS::DOM::Exception
SYNTAX_ERR,
'1 is not a valid property declaration'
};
$@ == SYNTAX_ERR; # true
print $@; # prints "1 is not a valid property declaration
";
DESCRIPTION
This module implementations the W3C's DOMException interface. CSS::DOM::Exception objects stringify to the message passed to the
constructer and numify to the error number (see below, under 'EXPORTS').
METHODS
new CSS::DOM::Exception $type, $message
This class method creates a new exception object. $type is expected to be an integer (you can use the constants listed under
'EXPORTS'). $message is the error message.
EXPORTS
The following constants are optionally exported. The descriptions are copied from the DOM spec.
INDEX_SIZE_ERR(1)
If index or size is negative, or greater than the allowed value
DOMSTRING_SIZE_ERR(2)
If the specified range of text does not fit into a DOMString
HIERARCHY_REQUEST_ERR(3)
If any node is inserted somewhere it doesn't belong
WRONG_DOCUMENT_ERR(4)
If a node is used in a different document than the one that created it (that doesn't support it)
INVALID_CHARACTER_ERR(5)
If an invalid character is specified, such as in a name.
NO_DATA_ALLOWED_ERR(6)
If data is specified for a node which does not support data
NO_MODIFICATION_ALLOWED_ERR(7)
If an attempt is made to modify an object where modifications are not allowed
NOT_FOUND_ERR(8)
If an attempt was made to reference a node in a context where it does not exist
NOT_SUPPORTED_ERR(9)
If the implementation does not support the type of object requested
INUSE_ATTRIBUTE_ERR(10)
If an attempt is made to add an attribute that is already inuse elsewhere
INVALID_STATE_ERR(11)
If an attempt is made to use an object that is not, or is no longer, usable
SYNTAX_ERR(12)
If an invalid or illegal string is specified
INVALID_MODIFICATION_ERR(13)
If an attempt is made to modify the type of the underlying object
NAMESPACE_ERR(14)
If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces
INVALID_ACCESS_ERR(15)
If a parameter or an operation is not supported by the underlying object
SEE ALSO
CSS::DOM, HTML::DOM::Exception
perl v5.10.1 2010-12-10 CSS::DOM::Exception(3pm)
Check Out this Related Man Page
CSS::DOM::Style(3pm) User Contributed Perl Documentation CSS::DOM::Style(3pm)NAME
CSS::DOM::Style - CSS style declaration class for CSS::DOM
VERSION
Version 0.14
SYNOPSIS
use CSS::DOM::Style;
$style = CSS::DOM::Style::parse(' text-decoration: none ');
$style->cssText; # returns 'text-decoration: none'
$style->cssText('color: blue'); # replace contents
$style->getPropertyValue('color'); # 'blue'
$style->color; # same
$style->setProperty(color=>'green'); # change it
$style->color('green'); # same
DESCRIPTION
This module provides the CSS style declaration class for CSS::DOM. (A style declaration is what comes between the braces in "p { margin: 0
}".) It implements the CSSStyleDeclaration DOM interface.
CONSTRUCTORS
CSS::DOM::Style::parse( $string )
CSS::DOM::Style::parse( $string, property_parser => $parser )
This parses the $string and returns a new style declaration object. This is useful if you have text from an HTML "style" attribute, for
instance.
For details on $property_parser, see CSS::DOM::PropertyParser.
new CSS::DOM::Style $owner_rule
new CSS::DOM::Style owner => $owner_rule, property_parser => $p
You don't normally need to call this, but, in case you do, here it is. $owner_rule, which is optional, is expected to be a
CSS::DOM::Rule object, or a subclass like CSS::DOM::Rule::Style.
METHODS
cssText ( $new_value )
Returns the body of this style declaration (without the braces). If you pass an argument, it will parsed and replace the existing CSS
data.
getPropertyValue ( $name )
Returns the value of the named CSS property as a string.
getPropertyCSSValue ( $name )
Returns an object representing the property's value. (See CSS::DOM::Value.)
removeProperty ( $name )
Removes the named property, returning its value.
getPropertyPriority
Returns the property's priority. This is usually the empty string or the word 'important'.
setProperty ( $name, $value, $priority )
Sets the CSS property named $name, giving it a value of $value and setting the priority to $priority.
length
Returns the number of properties
item ( $index )
Returns the name of the property at the given index.
parentRule
Returns the rule to which this declaration belongs.
modification_handler ( $coderef )
This method, not part of the DOM, allows you to attach a call-back routine that is run whenever a change occurs to the style object
(with the style object as its only argument). If you call it without an argument it returns the current handler. With an argument, it
returns the old value after setting it.
property_parser
This returns the parser that was passed to the constructor.
This module also has methods for accessing each CSS property directly. Simply capitalise each letter in a CSS property name that follows a
hyphen, then remove the hyphens, and you'll have the method name. E.g., call the "borderBottomWidth" method to get/set the border-bottom-
width property. One exception to this is that "cssFloat" is the method used to access the 'float' property. (But you can also use the
"float" method, though it's not part of the DOM standard.)
SEE ALSO
CSS::DOM
CSS::DOM::Rule::Style
CSS::DOM::PropertyParser
HTML::DOM::Element
perl v5.10.1 2010-12-10 CSS::DOM::Style(3pm)