.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "CSS::DOM::Style 3pm" .TH CSS::DOM::Style 3pm "2018-02-12" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CSS::DOM::Style \- CSS style declaration class for CSS::DOM .SH "VERSION" .IX Header "VERSION" Version 0.17 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use CSS::DOM::Style; \& \& $style = CSS::DOM::Style::parse(\*(Aq text\-decoration: none \*(Aq); \& \& $style\->cssText; # returns \*(Aqtext\-decoration: none\*(Aq \& $style\->cssText(\*(Aqcolor: blue\*(Aq); # replace contents \& \& $style\->getPropertyValue(\*(Aqcolor\*(Aq); # \*(Aqblue\*(Aq \& $style\->color; # same \& $style\->setProperty(color=>\*(Aqgreen\*(Aq); # change it \& $style\->color(\*(Aqgreen\*(Aq); # same .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides the \s-1CSS\s0 style declaration class for \s-1CSS::DOM\s0. (A style declaration is what comes between the braces in \f(CW\*(C`p { margin: 0 }\*(C'\fR.) It implements the CSSStyleDeclaration \s-1DOM\s0 interface. .SH "CONSTRUCTORS" .IX Header "CONSTRUCTORS" .ie n .IP "CSS::DOM::Style::parse( $string )" 4 .el .IP "CSS::DOM::Style::parse( \f(CW$string\fR )" 4 .IX Item "CSS::DOM::Style::parse( $string )" .PD 0 .ie n .IP "CSS::DOM::Style::parse( $string, property_parser => $parser )" 4 .el .IP "CSS::DOM::Style::parse( \f(CW$string\fR, property_parser => \f(CW$parser\fR )" 4 .IX Item "CSS::DOM::Style::parse( $string, property_parser => $parser )" .PD This parses the \f(CW$string\fR and returns a new style declaration object. This is useful if you have text from an \s-1HTML\s0 \f(CW\*(C`style\*(C'\fR attribute, for instance. .Sp For details on \f(CW$property_parser\fR, see CSS::DOM::PropertyParser. .ie n .IP "new CSS::DOM::Style $owner_rule" 4 .el .IP "new CSS::DOM::Style \f(CW$owner_rule\fR" 4 .IX Item "new CSS::DOM::Style $owner_rule" .PD 0 .ie n .IP "new CSS::DOM::Style owner => $owner_rule, property_parser => $p" 4 .el .IP "new CSS::DOM::Style owner => \f(CW$owner_rule\fR, property_parser => \f(CW$p\fR" 4 .IX Item "new CSS::DOM::Style owner => $owner_rule, property_parser => $p" .PD You don't normally need to call this, but, in case you do, here it is. \&\f(CW$owner_rule\fR, which is optional, is expected to be a CSS::DOM::Rule object, or a subclass like CSS::DOM::Rule::Style. .SH "METHODS" .IX Header "METHODS" .ie n .IP "cssText ( $new_value )" 4 .el .IP "cssText ( \f(CW$new_value\fR )" 4 .IX Item "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 \s-1CSS\s0 data. .ie n .IP "getPropertyValue ( $name )" 4 .el .IP "getPropertyValue ( \f(CW$name\fR )" 4 .IX Item "getPropertyValue ( $name )" Returns the value of the named \s-1CSS\s0 property as a string. .ie n .IP "getPropertyCSSValue ( $name )" 4 .el .IP "getPropertyCSSValue ( \f(CW$name\fR )" 4 .IX Item "getPropertyCSSValue ( $name )" Returns an object representing the property's value. (See CSS::DOM::Value.) .ie n .IP "removeProperty ( $name )" 4 .el .IP "removeProperty ( \f(CW$name\fR )" 4 .IX Item "removeProperty ( $name )" Removes the named property, returning its value. .IP "getPropertyPriority" 4 .IX Item "getPropertyPriority" Returns the property's priority. This is usually the empty string or the word 'important'. .ie n .IP "setProperty ( $name, $value, $priority )" 4 .el .IP "setProperty ( \f(CW$name\fR, \f(CW$value\fR, \f(CW$priority\fR )" 4 .IX Item "setProperty ( $name, $value, $priority )" Sets the \s-1CSS\s0 property named \f(CW$name\fR, giving it a value of \f(CW$value\fR and setting the priority to \f(CW$priority\fR. .IP "length" 4 .IX Item "length" Returns the number of properties .ie n .IP "item ( $index )" 4 .el .IP "item ( \f(CW$index\fR )" 4 .IX Item "item ( $index )" Returns the name of the property at the given index. .IP "parentRule" 4 .IX Item "parentRule" Returns the rule to which this declaration belongs. .ie n .IP "modification_handler ( $coderef )" 4 .el .IP "modification_handler ( \f(CW$coderef\fR )" 4 .IX Item "modification_handler ( $coderef )" This method, not part of the \s-1DOM,\s0 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. .IP "property_parser" 4 .IX Item "property_parser" This returns the parser that was passed to the constructor. .PP This module also has methods for accessing each \s-1CSS\s0 property directly. Simply capitalise each letter in a \s-1CSS\s0 property name that follows a hyphen, then remove the hyphens, and you'll have the method name. E.g., call the \&\f(CW\*(C`borderBottomWidth\*(C'\fR method to get/set the border-bottom-width property. One exception to this is that \f(CW\*(C`cssFloat\*(C'\fR is the method used to access the \&'float' property. (But you can also use the \f(CW\*(C`float\*(C'\fR method, though it's not part of the \s-1DOM\s0 standard.) .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1CSS::DOM\s0 .PP CSS::DOM::Rule::Style .PP CSS::DOM::PropertyParser .PP HTML::DOM::Element