From ac5c326058425050aa8f7ba5036f2f3bc0695350 Mon Sep 17 00:00:00 2001 From: Mischa Poslawsky Date: Fri, 25 Jul 2008 16:10:30 +0200 Subject: [PATCH] ignore empty style and class attributes --- lib/HTML/Form/Simple.pm | 9 +++++++-- t/html.t | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/HTML/Form/Simple.pm b/lib/HTML/Form/Simple.pm index b4e42aa..6e84888 100644 --- a/lib/HTML/Form/Simple.pm +++ b/lib/HTML/Form/Simple.pm @@ -22,7 +22,7 @@ sub tag { # strip empty if it shouldn't be defined $attr->{$_} and $attr->{$_} eq '' and delete $attr->{$_} - for qw(id type); + for qw(id type class style); my $return = '<' . $tag; @@ -129,7 +129,12 @@ HTML::Form::Simple my $input = HTML::Form::Simple->new; say $input->start; #
printf "\n", @$_ for ( - [ 'Your Name' => $input->text(username => 'Mr. Default') ], + [ 'Your Name' => $input->text( + user => 'Mr. Default' + ) ], + [ Message => $input->text( + msg => 'Textarea default', {rows => 4, style => 'background:red'} + ) ], [ Colour => $input->select( favcolour => [qw(Blue Green Red)], 'Green' ) ], diff --git a/t/html.t b/t/html.t index 0535da9..e023997 100644 --- a/t/html.t +++ b/t/html.t @@ -119,7 +119,7 @@ is( ); is( - $form->input('', '', {disabled => 0, something => undef}), + $form->input('', '', {disabled => 0, something => undef, class => undef, style => ''}), '', 'input with empty attributes' ); -- 2.30.0