ignore empty style and class attributes
authorMischa Poslawsky <mischa@mediadesign.nl>
Fri, 25 Jul 2008 14:10:30 +0000 (16:10 +0200)
committerMischa Poslawsky <mischa@mediadesign.nl>
Fri, 25 Jul 2008 14:10:30 +0000 (16:10 +0200)
lib/HTML/Form/Simple.pm
t/html.t

index b4e42aa947260cf57be5d1d17519991f454f54d8..6e84888296e51a5deb508b6232f69a0c00c085cf 100644 (file)
@@ -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; # <form>
        printf "<label>%s: %s</label>\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'
                ) ],
index 0535da9294a35f8f58143a5bcdbf3c713c04aa59..e023997831b20a951b6fd949dc55dbe0e2a4bb7e 100644 (file)
--- 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 name="" type="text" value="">',
        'input with empty attributes'
 );