CSS-DOM
view release on metacpan or search on metacpan
lib/CSS/DOM/Interface.pm view on Meta::CPAN
speakPunctuation => STR,
speechRate => STR,
stress => STR,
tableLayout => STR,
textAlign => STR,
textDecoration => STR,
textIndent => STR,
textShadow => STR,
textTransform => STR,
top => STR,
unicodeBidi => STR,
verticalAlign => STR,
visibility => STR,
voiceFamily => STR,
volume => STR,
whiteSpace => STR,
widows => STR,
width => STR,
wordSpacing => STR,
zIndex => STR,
},
lib/CSS/DOM/Parser.pm view on Meta::CPAN
($hash)|($percent)|($dim)|($num)|(<!--|-->)|(;)|(\{)|(})|(\()|(\))
|(\[)|(])|($space)|(~=)|(\|=)|(,)|(:)|(.)
)/xs;
} # end of tokeniser regexps
# tokenise returns a string of token types in addition to the array of
# tokens so that we can apply grammar rules using regexps. The types are
# as follows:
# u url
# U unicode range
# f function
# i identifier
# @ at keyword
# ' string
# " invalid string (unterminated)
# # hash
# % percentage
# D dimension
# 1 number (not 0, because we want it true)
# < html comment delimiter
lib/CSS/DOM/PropertyParser.pm view on Meta::CPAN
default => 'none',
inherit => 1,
},
top => {
format => '<length>|<percentage>|auto',
default => 'auto',
inherit => 0,
},
'unicode-bidi' => {
format => 'normal|embed|bidi-override',
default => 'normal',
inherit => 0,
},
'vertical-align' => {
format => 'baseline|sub|super|top|text-top|middle|bottom|
text-bottom|<percentage>|<length>',
default => 'baseline',
inherit => 0,
t/CSS2Properties.t view on Meta::CPAN
use strict; use warnings;
our $tests;
BEGIN { ++$INC{'tests.pm'} }
sub tests'VERSION { $tests += pop };
sub tests'import { $tests += pop if @_ > 1 };
use Test::More;
plan tests => $tests;
BEGIN {
our @props = qw /azimuth background background-attachment background-color background-image background-position background-repeat border border-bottom border-bottom-color border-bottom-style border-bottom-width border-collapse border-color border-lef...
}
require CSS::DOM::Style;
my $decl = CSS::DOM::Style::parse
( join('', map"$_: 65;", our @props) );
use tests +4 * our @props; # normal CSS property methods
for (@props) {
(my $meth = $_) =~ s/-(.)/\u$1/g;
is $decl->$meth, '65', "get $meth";
t/charset.t view on Meta::CPAN
use utf8;
use CSS::DOM;
use tests 4; # options
like CSS::DOM::parse qq|\@charset "utf-8"; {font:'\xc3\xb0'}|
=>->cssRules->[1]->style->font,
qr/\xc3\xb0/, 'no decode/encoding_hint param assumes unicode';
like CSS::DOM::parse "{font:'\xc3\xb0'}",
decode => 1
=>->cssRules->[0]->cssText, qr/\xf0/,
'decode => 1 assumes utf-8 in the absence of encoding info';
like CSS::DOM::parse "{font:'\xc3\xb0'}",
encoding_hint => 'iso-8859-7'
=>->cssRules->[0]->cssText, qr/\x{393}\260/,
'encoding_hint implies decode => 1';
like CSS::DOM::parse "{font:'\xc3\xb0'}",
decode => 1, encoding_hint => 'iso-8859-7'
t/parser-tokens.t view on Meta::CPAN
is $style->name, 'url("foo")',
'double-quoted url without )';
$style->name(q"url('foo' ");
is $style->name, q"url('foo' )",
'single-quoted url without ) but with ws';
$style->name('url("foo" ');
is $style->name, 'url("foo" )',
'double-quoted url without ) but with ws';
}
# ~~~ unicode range
# Come to think of it, if we didnât support this as a separate token,
# U+abcd-U+012a would be interpreted as
# ident [U], delim [+], ident [abcd], delim [-], dim [012a]
# which would still become a CSS_UNKNOWN value whose cssText value returned
# exactly the same. So a test for it would pass whether unirange were a
# token or not. (Or would it become a primitive with a type of CSS_CUSTOM?)
use tests 3; # spaces and comments
{
my $style = CSS::DOM::Style::parse(
t/property-parser.t view on Meta::CPAN
$s->textTransform($_);
is $s->textTransform, $_, "text-transform value: \L$_"
}
use tests 3; # top
for(qw/5em 5% auto/){
$s->top($_);
is $s->top, $_, "setting top to $_";
}
use tests 3; # unicode-bidi
for(qw/normal embed bidi-override/){
$s->unicodeBidi($_);
is $s->unicodeBidi, $_, "setting unicode-bidi to $_";
}
use tests 10; # vertical-align
for(qw/ baseline sub super top text-top middle bottom text-bottom 5% 5em/){
$s->verticalAlign($_);
is $s->verticalAlign, $_, "setting vertical-align to $_";
}
use tests 3; # visibility
for(qw/ visible hidden collapse /){
( run in 0.448 second using v1.01-cache-2.11-cpan-88abd93f124 )