Because the <input type="button"> tag doesn't allow text other than
the value to be displayed in the button, I've had to start using the
<button> tag on some of my pages. Imagine my dismay when this caused
WWW::Mechanize to no longer recognize that my form had buttons!
After poking around WWW::Mechanize for a bit, I was led to HTML::Form,
which doesn't currently recognize <button> tags. This patch certainly
fixes the issue I was having, and I think it represents a generally
applicable enhancement. I'd love to see it included in the next drop
of libwww-perl.
--- Form.pm.orig 2004-06-16 06:41:23.000000000 -0400
+++ Form.pm 2004-07-19 11:03:31.000000000 -0400
@@ -96,7 +96,7 @@
my $p = HTML::TokeParser->new(ref($html) ? $html->content_ref : \$html);
eval {
# optimization
- $p->report_tags(qw(form input textarea select optgroup option keygen));
+ $p->report_tags(qw(button form input textarea select optgroup option
keygen));
};
unless (defined $base_uri) {
@@ -130,6 +130,11 @@
$attr->{value_name} = $p->get_phrase;
$f->push_input($type, $attr);
}
+ elsif ($tag eq "button") {
+ my $type = delete $attr->{type} || "submit";
+ $attr->{value_name} = $p->get_phrase;
+ $f->push_input($type, $attr);
+ }
elsif ($tag eq "textarea") {
$attr->{textarea_value} = $attr->{value}
if exists $attr->{value};
Mike
--
I'd write a song called "Senorita with a Necklace of Tears" -- Paul Simon
|