use strict;
use warnings;
-our $VERSION = '0.001';
+our $VERSION = '0.003';
my $ESCAPE_RE = qr/\\[^0-9a-fA-F]|\\[0-9a-fA-F]{1,6}/;
my $ATTR_RE = qr/
# Attributes
elsif ($css =~ /\G$ATTR_RE/gco) {
- push @$last, ['attr', _name($1), _value($2 // '', $3 // $4 // $5, $6)];
+ push @$last, [
+ 'attr', _name($1),
+ _value(
+ defined($2) ? $2 : '',
+ defined($3) ? $3 : defined($4) ? $4 : $5,
+ $6
+ ),
+ ];
}
# Pseudo-class (":not" contains more selectors)
return $num if $equation !~ /(?:(-?(?:\d+)?)?(n))?\s*\+?\s*(-?\s*\d+)?\s*$/i;
$num->[0] = defined($1) && $1 ne '' ? $1 : $2 ? 1 : 0;
$num->[0] = -1 if $num->[0] eq '-';
- $num->[1] = $3 // 0;
+ $num->[1] = defined($3) ? $3 : 0;
$num->[1] =~ s/\s+//g;
return $num;
}