use strict;
use warnings;
-use DOM::Tiny::Entities qw(html_unescape xml_escape);
+use DOM::Tiny::Entities qw(html_escape html_unescape);
use Scalar::Util 'weaken';
use Class::Tiny::Chained 'xml', { tree => sub { ['root'] } };
# Attributes
my (%attrs, $closing);
while ($attr =~ /$ATTR_RE/go) {
- my ($key, $value) = ($xml ? $1 : lc $1, defined $3 ? $3 : $4);
+ my ($key, $value) = ($xml ? $1 : lc $1, $3 // $4);
# Empty tag
++$closing and next if $key eq '/';
# Text (escaped)
my $type = $tree->[0];
- return xml_escape($tree->[1]) if $type eq 'text';
+ return html_escape($tree->[1]) if $type eq 'text';
# Raw text
return $tree->[1] if $type eq 'raw';
for my $key (sort keys %{$tree->[2]}) {
my $value = $tree->[2]{$key};
$result .= $xml ? qq{ $key="$key"} : " $key" and next unless defined $value;
- $result .= qq{ $key="} . xml_escape($value) . '"';
+ $result .= qq{ $key="} . html_escape($value) . '"';
}
# No children
=head1 METHODS
-L<DOM::Tiny::HTML> implements the following methods.
+L<DOM::Tiny::HTML> inherits a constructor from L<Class::Tiny::Object|Class::Tiny/"Object construction">,
+and implements the following methods.
=head2 parse