Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
small optimizations
  • Loading branch information
kraih committed Aug 21, 2012
1 parent 0e1b18c commit 9109d1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 4 additions & 6 deletions lib/Mojo/DOM/HTML.pm
Expand Up @@ -82,12 +82,10 @@ sub parse {
my ($self, $html) = @_;

# Try to decode (and fall back to no charset)
if (my $charset = $self->charset) {
my $backup = $html;
unless (defined($html = decode $charset, $html)) {
$html = $backup;
$self->charset(undef);
}
my $charset = $self->charset;
if ($charset && !defined($html = decode $charset, my $backup = $html)) {
$html = $backup;
$self->charset(undef);
}

# Tokenize
Expand Down
3 changes: 0 additions & 3 deletions lib/Mojo/Util.pm
Expand Up @@ -326,7 +326,6 @@ sub xml_escape {
return $string;
}

# Helper for punycode
sub _adapt {
my ($delta, $numpoints, $firsttime) = @_;

Expand All @@ -342,7 +341,6 @@ sub _adapt {
return $k + (((PC_BASE - PC_TMIN + 1) * $delta) / ($delta + PC_SKEW));
}

# Helper for html_unescape
sub _decode {

# Numeric
Expand All @@ -358,7 +356,6 @@ sub _decode {
return "&$_[1]";
}

# Helper for html_escape
sub _encode {
return exists $REVERSE{$_[0]} ? "&$REVERSE{$_[0]}" : "&#@{[ord($_[0])]};";
}
Expand Down

0 comments on commit 9109d1f

Please sign in to comment.