NAME
CSS::DOM::Style - CSS style declaration class for CSS::DOM
VERSION
Version 0.03
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 )
-
This parses the
$stringand returns a new style declaration object. This is useful if you have text from an HTMLstyleattribute, for instance. - new CSS::DOM::Style $owner_rule
-
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
- removeProperty
- getPropertyPriority
-
(not yet implmeented)
- setProperty ( $name, $value, $priority )
-
Sets the CSS property named
$name, giving it a value of$value.$priorityis currently ignored (to be implemented later). - length
- item ( $index )
-
(not yet implmeented)
- parentRule
-
Returns the rule to which this declaration belongs.
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.)