Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Shaving off one line of code
  • Loading branch information
Jan Henning Thorsen committed Feb 25, 2016
1 parent 7df1f8d commit a6b7d85
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Mojo/DOM.pm
Expand Up @@ -166,9 +166,8 @@ sub val {
return $self->{value} // $self->text if (my $tag = $self->tag) eq 'option';

# "input" ("type=checkbox" and "type=radio")
my $type = $self->{type} // '';
return $self->{value} // 'on'
if $tag eq 'input' && ($type eq 'checkbox' || $type eq 'radio');
if $tag eq 'input' && grep { $self->{type} // '' eq $_ } qw(checkbox radio);

# "textarea", "input" or "button"
return $tag eq 'textarea' ? $self->text : $self->{value} if $tag ne 'select';
Expand Down

0 comments on commit a6b7d85

Please sign in to comment.