Skip to content

Commit

Permalink
no need for a default value
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 10, 2015
1 parent 81dbe9d commit c4f4cad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Mojo/DOM/HTML.pm
Expand Up @@ -4,8 +4,7 @@ use Mojo::Base -base;
use Mojo::Util qw(html_unescape xml_escape);
use Scalar::Util 'weaken';

has 'xml';
has tree => sub { ['root'] };
has [qw(tree xml)];

my $ATTR_RE = qr/
([^<>=\s\/]+|\/) # Key
Expand Down Expand Up @@ -200,7 +199,7 @@ sub _render {
my ($tree, $xml) = @_;

# Text (escaped)
my $type = $tree->[0];
return '' unless my $type = $tree->[0];
return xml_escape $tree->[1] if $type eq 'text';

# Raw text
Expand Down
3 changes: 3 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -3,6 +3,9 @@ use Mojo::Base -strict;
use Test::More;
use Mojo::DOM;

# Empty
is(Mojo::DOM->new, '', 'right result');

# Simple (basics)
my $dom = Mojo::DOM->new(
'<div><div FOO="0" id="a">A</div><div id="b">B</div></div>');
Expand Down

0 comments on commit c4f4cad

Please sign in to comment.