Skip to content

Commit

Permalink
made Mojo::DOM::HTML a little more resilient (closes #374)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 21, 2012
1 parent aab340c commit 3a828f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,5 +1,6 @@

3.33 2012-08-21
- Improved resilience of Mojo::DOM::HTML.
- Improved documentation.

3.32 2012-08-20
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojo/DOM/HTML.pm
Expand Up @@ -81,8 +81,9 @@ my %INLINE = map { $_ => 1 } @HTML4_INLINE, @HTML5_INLINE;
sub parse {
my ($self, $html) = @_;

# Decode
if (my $charset = $self->charset) { $html = decode $charset, $html }
# Try to decode
my $charset = $self->charset;
$html = decode($charset, $html) // $html if $charset;

# Tokenize
my $tree = ['root'];
Expand Down

0 comments on commit 3a828f0

Please sign in to comment.