Skip to content

Commit

Permalink
fixed another small XML bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 4, 2014
1 parent 6177489 commit 93266ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/HTML.pm
Expand Up @@ -145,7 +145,7 @@ sub parse {

# Processing instruction (try to detect XML)
elsif (defined $pi) {
$self->xml(1) if !defined $self->xml && $pi =~ /xml/i;
$self->xml(1) if !exists $self->{xml} && $pi =~ /xml/i;
push @$current, ['pi', $pi];
}
}
Expand Down
2 changes: 2 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -1753,6 +1753,8 @@ is $dom, '<XMLTest2 />', 'right result';
$dom = Mojo::DOM->new->xml(0)
->parse('<?xml version="1.0" encoding="UTF-8"?><br><div>Test</div>');
is $dom->at('div:root')->text, 'Test', 'right text';
ok !Mojo::DOM->new->xml(undef)->parse('<?xml version="1.0"?>')->xml,
'XML mode not detected';

# Ensure XML semantics
$dom = Mojo::DOM->new->parse(<<'EOF');
Expand Down

0 comments on commit 93266ac

Please sign in to comment.