CSS-DOM
view release on metacpan or search on metacpan
lib/CSS/DOM/PropertyParser.pm view on Meta::CPAN
. join("|", map $_[$_] . _permute(@_[0..$_-1,$_+1...$#_]) . '?', 0..$#_)
. ")"
}
}
=begin comment
Colour names:
perl -MRegexp::Assemble -le 'my $ra = new Regexp::Assemble; $ra->add($_) for qw " transparent aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflow...
perl -MRegexp::Assemble -le 'my $ra = new Regexp::Assemble; $ra->add($_) for qw " activeborder activecaption appworkspace background buttonface buttonhighlight buttonshadow buttontext captiontext graytext highlight highlighttext inactiveborder inacti...
=end comment
=cut
$colour_names_re = '(?:d(?:ark(?:s(?:late(?:gr[ae]y|blue)|(?:eagree|almo)n)|g(?:r(?:e(?:en|y)|ay)|oldenrod)|o(?:r(?:ange|chid)|livegreen)|(?:turquois|blu)e|magenta|violet|khaki|cyan|red)|eep(?:skyblue|pink)|imgr[ae]y|odgerblue)|l(?:i(?:ght(?:s(?:(?:e...
$system_colour_names_re = '(?:in(?:active(?:caption|border)|fo(?:background|text)|cativecaptiontext)|b(?:utton(?:(?:highligh|tex)t|shadow|face)|ackground)|threed(?:(?:light|dark)?shadow|highlight|face)|(?:(?:caption|gray)tex|highligh(?:ttex)?)t|a(?:c...
lib/CSS/DOM/PropertyParser.pm view on Meta::CPAN
},
'background-attachment' => {
format => 'scroll | fixed',
default => 'scroll',
inherit => 0,
},
'background-color' => {
format => '<colour>',
default => 'transparent',
inherit => 0,
},
'background-image' => {
format => '<url> | none',
default => 'none',
inherit => 0,
},
'background-position' => {
t/property-parser.t view on Meta::CPAN
use tests 3; # background-attachment
for(qw/ scroll fixed /) {
$s->backgroundAttachment($_);
is $s->backgroundAttachment, $_, "background-attachment value: \L$_"
}
$s->backgroundAttachment('38');
is $s->backgroundAttachment, 'fixed', "invalid bg-attachment value: 38";
use tests 197; # background-color
for(qw/ #abc #abcdef rgb(1,2,3) rgb(1%,2%,3%) rgba(1,2,3,4)
rgba(1%,2%,3%,4) transparent Aliceblue antiquewhitE aqua
aquamarine azure beige bisque black blanchedalmond blue blueviolet
brown burlywood cadetblue chartreuse chocolate coral cornflowerblue
cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray
darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange
darkorchid darkred darksalmon darkseagreen darkslateblue
darkslategray darkslategrey darkturquoise darkviolet deeppink
deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite
forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green
greenyellow grey honeydew hotpink indianred indigo ivory khaki
lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral
t/property-parser.t view on Meta::CPAN
$s->background('white');
is $s->background, 'white', 'background: colour';
is &$props, 'white,none,repeat,scroll,0% 0%',
'other sub-properties after setting background to colour';
is # bug fixed in 0.09, that only occurred in 5.10.0 [RT #54809]
$s->getPropertyCSSValue('background-color')->cssValueType,
1, # CSS_PRIMITIVE_VALUE
'value types of named subprops of shorthand props after sh. assignment';
$s->background('url(foo)');
is $s->background, 'url(foo)', 'background: url';
is &$props, 'transparent,url(foo),repeat,scroll,0% 0%',
'other sub-properties after setting background to url';
$s->background('no-repeat');
is $s->background, 'no-repeat', 'background: repeat';
is &$props, 'transparent,none,no-repeat,scroll,0% 0%',
'other sub-properties after setting background to repeat';
$s->background('fixed');
is $s->background, 'fixed', 'background: attachment';
is &$props, 'transparent,none,repeat,fixed,0% 0%',
'other sub-properties after setting background to attachment';
$s->background('top');
is $s->background, 'top', 'background: position (single keyword)';
is &$props, 'transparent,none,repeat,scroll,top',
'other sub-properties after setting background to position (single)';
$s->background('top left');
is $s->background, 'top left', 'background: position (two words)';
is &$props, 'transparent,none,repeat,scroll,top left',
'other sub-properties after setting background to position';
$s->background('red url("foo") no-repeat center center fixed');
is $s->background, 'red url("foo") no-repeat fixed center center',
'background with five values';
is &$props, 'red,url("foo"),no-repeat,fixed,center center',
'bg subprops after setting all at once';
$s->background('bottom scroll repeat-y none #00f');
is $s->background, '#00f repeat-y bottom',
'background with five values in reverse order';
is &$props, '#00f,none,repeat-y,scroll,bottom',
'bg subprops after setting backwards';
$s->background('');
is $s->background, '', 'setting background to nothing ...';
is &$props, ',,,,', ' ... resets all its sub-properties';
$s->background('blue');
$s->backgroundAttachment("");
is $s->background, '',
'background is blank if not all sub-properties are specified';
$s->background('transparent none repeat scroll 0% 0%');
is $s->background, 'none',
'background is none when all sub-properties are set to initial values';
}
$s->background('red');
$s->background("top red left");
is $s->background, 'red', "invalid background value: top red left";
$s->background("0");
is $s->background, "0", 'setting background to 0';
use tests 3; # border-collapse
( run in 0.350 second using v1.01-cache-2.11-cpan-0a6323c29d9 )