- "5.14"
- "5.12"
- "5.10"
+ - "5.8"
{{$NEXT}}
+ - Support perl 5.8 (mst)
0.001 2015-11-09 02:56:35 EST
- First release
"Exporter" : "0",
"List::Util" : "0",
"Scalar::Util" : "0",
- "perl" : "5.010001"
+ "perl" : "5.008001"
}
},
"test" : {
use strict;
use warnings;
-use 5.010001;
+use 5.008001;
use ExtUtils::MakeMaker;
},
"DISTNAME" => "DOM-Tiny",
"LICENSE" => "artistic_2",
- "MIN_PERL_VERSION" => "5.010001",
+ "MIN_PERL_VERSION" => "5.008001",
"NAME" => "DOM::Tiny",
"PREREQ_PM" => {
"Carp" => 0,
Dan Book <dbook@cpan.org>
+=head1 CONTRIBUTORS
+
+=over
+
+=item Matt S Trout (mst)
+
+=back
+
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Dan Book.
-requires 'perl' => '5.010001';
+requires 'perl' => '5.008001';
requires 'Carp';
requires 'Exporter';
requires 'List::Util';
my $self = shift;
# "option"
- return $self->{value} // $self->text if (my $tag = $self->tag) eq 'option';
+ return defined($self->{value}) ? $self->{value} : $self->text
+ if (my $tag = $self->tag) eq 'option';
# "textarea", "input" or "button"
return $tag eq 'textarea' ? $self->text : $self->{value} if $tag ne 'select';
Dan Book <dbook@cpan.org>
+=head1 CONTRIBUTORS
+
+=over
+
+=item Matt S Trout (mst)
+
+=back
+
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Dan Book.
# 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;
}
}
sub join {
- join $_[1] // '', map {"$_"} @{$_[0]};
+ join +(defined($_[1]) ? $_[1] : ''), map {"$_"} @{$_[0]};
}
sub last { shift->[-1] }
our $VERSION = '0.002';
my $ATTR_RE = qr/
- ([^<>=\s\/]+|\/) # Key
+ ([^<>=\s\/]+|\/) # Key
(?:
\s*=\s*
- (?s:(["'])(.*?)\g{-2}|([^>\s]*)) # Value
+ (?s:(?:"(.*?)")|(?:'(.*?)')|([^>\s]*)) # Value
)?
\s*
/x;
|
\?(.*?)\? # Processing Instruction
|
- \s*([^<>\s]+\s*(?:(?:$ATTR_RE){0,32766})*+) # Tag
+ \s*([^<>\s]+\s*(?>(?:$ATTR_RE){0,32766})*) # Tag
+ # Workaround for perl's limit of * to {0,32767}
)>
|
(<) # Runaway "<"
# HTML elements that only contain raw text and entities
my %RCDATA = map { $_ => 1 } qw(title textarea);
-# HTML elements with optional end tags
-my %END = (body => 'head', optgroup => 'optgroup', option => 'option');
-
-# HTML elements that break paragraphs
-map { $END{$_} = 'p' } (
- qw(address article aside blockquote dir div dl fieldset footer form h1 h2),
- qw(h3 h4 h5 h6 header hr main menu nav ol p pre section table ul)
+my %END = (
+ # HTML elements with optional end tags
+ body => 'head', optgroup => 'optgroup', option => 'option',
+ # HTML elements that break paragraphs
+ map +($_ => 'p'),
+ qw(address article aside blockquote dir div dl fieldset footer form h1 h2),
+ qw(h3 h4 h5 h6 header hr main menu nav ol p pre section table ul)
);
# HTML table elements with optional end tags
# Attributes
my (%attrs, $closing);
while ($attr =~ /$ATTR_RE/go) {
- my ($key, $value) = ($xml ? $1 : lc $1, $3 // $4);
+ my $key = $xml ? $1 : lc $1;
+ my $value = defined($2) ? $2 : defined($3) ? $3 : $4;
# Empty tag
++$closing and next if $key eq '/';