Web::CSS::Serializer
A CSS serializer
DESCRIPTION
The Web::CSS::Serializer
class has several methods to serialize parsed constructs generated by Web::CSS::Parser into CSS's textual form.
This module is not for general use. For most purposes, applications should use CSSOM standard API implemented by Web::DOM::CSSStyleSheet and related modules.
METHODS
Following methods are available:
$serializer = Web::CSS::Serializer->new
-
Return a new serializer instance.
$context = $serializer->context
$serializer->context ($context)
-
Return or set the Web::CSS::Context object used for serialization.
$string = $serializer->serialize_mq ($mq)
-
Serialize a media query. See Web::CSS::MediaQueries::Serializer for details.
$string = $serializer->serialize_mq_list ($mq_list)
-
Serialize a list of media queries. See Web::CSS::MediaQueries::Serializer for details.
$string = $serializer->serialize_prop_decls ($style)
-
Return the character string representation of the list of declarations, declaring property values (and
important
flags) contained by the specified property construct (See Web::DOM::Parser). $string = $serializer->serialize_prop_priority ($style, $key)
-
Return the character string representation of the
important
flag of the property. The first argument must be a property construct, possibly containing the property in question (See Web::CSS::Parser). The second argument must be the key identifying the property (See Web::CSS::Props). If the specified property has theimportant
flag, the stringimportant
is returned. Otherwiseundef
is returned. $string = $serializer->serialize_prop_value ($style, $key)
-
Return the character string representation of the property value. The first argument must be a property construct, possibly containing the property value in question (See Web::CSS::Parser). The second argument must be the key identifying the property (See Web::CSS::Props). If the specified property has no value,
undef
is returned. $string = $serializer->serialize_rule ($rule_set, $rule_id)
-
Return the character string representation of the specified CSS style sheet or rule. The first argument must be a parsed style sheet construct (See Web::CSS::Parser) containing the sheet or rule in question. The second argument must be the ID in the parsed style sheet, identifying the sheet or rule to serialize.
$string = $serializer->serialize_selectors ($selectors)
-
Return the character string representation of the specified list of selectors. See Web::CSS::Selectors::Serializer for details.
$string = $serializer->serialize_value ($value)
-
Return the character string representation of the specified CSS value. The argument must be a parsed representation of the CSS value. See also Web::CSS::Values.
SPECIFICATIONS
- CSSOM
-
CSS Object Model (CSSOM)
<http://dev.w3.org/csswg/cssom/>
.To "serialize a CSS component value" which is <angle>, <frequency>, <length>, or <resolution>, instead of the unit hardcoded in the spec, the original unit of the value, converted to ASCII lowercase, MUST be used.
To "serialize a CSS component value", "0" before decimal dot MUST NOT be omitted.
To "serialize a CSS rule", if the rule is a
CSSMediaRule
, the result of concatenating the following MUST be returned:1. The string "@media" followed by a U+0020 SPACE character 2. The result of performing serialize a media query list on the rule's associated media list. 3. A U+0020 SPACE character, followed by a U+007B LEFT CURLY BRACKET character ({), followed by a U+0020 SPACE character, followed by a U+000A LINE FEED character 4. For each rule in the child CSS rules of the rule, in order, concatenation of the following: 1. Two U+0020 SPACE characters 2. The result of performing serialize a CSS rule on the rule 3. A U+000A LINE FEED character 5. A U+000A LINE FEED character, followed by a U+007D RIGHT CURLY BRACKET character (}).
To serialize a CSS style sheet, it MUST perform serialize a CSS rule on the rule in the child CSS rule of the style sheet and concatenate them in order, separated by the U+000A LINE FEED character, and return the result string.
- MQ
-
Media Queries
<http://dev.w3.org/csswg/mediaqueries/#values>
.To serialize <ratio>, optional white space MUST NOT be inserted.
SEE ALSO
AUTHOR
Wakaba <wakaba@suikawiki.org>.
LICENSE
Copyright 2007-2013 Wakaba <wakaba@suikawiki.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.