Re: multiple boolean attributes for a given tag
Gisle Aas (gisle@aas.no)
04 Mar 1998 15:56:31 +0100
Sorry about this long delay. I have now applied your patch to my
version of the sources. Thanks!
Regards,
Gisle
Philip Guenther <guenther@gac.edu> writes:
> Good Morning,
>
> Here's a quick patch to teach HTML::Element how to handle the
> 'readonly' and 'disabled' attributes of the 'input' tag (added in the
> HTML 4.0 spec). Nothing fancy: just allow the values of %boolean_attr
> to be hash refs, and deepen the lookup in starttag(). Yeah, there are
> probably other tag/attributes combos that should be added with HTML
> 4.0, but I'm just need to get this project moved forward before a
> meeting this afternoon...
>
>
> Philip Guenther
>
> ----------------------------------------------------------------------
> guenther@gac.edu UNIX Systems and Network Administrator
> Gustavus Adolphus College St. Peter, MN 56082-1498
> Source code never lies: it just misleads (Programming by Purloined Letter?).
>
>
> *** lib/HTML/Element.pm.orig Tue Dec 2 06:48:09 1997
> --- lib/HTML/Element.pm Tue Jan 27 03:11:39 1998
> ***************
> *** 78,84 ****
> dl => 'compact',
> hr => 'noshade',
> img => 'ismap',
> ! input => 'checked',
> menu => 'compact',
> ol => 'compact',
> option => 'selected',
> --- 78,84 ----
> dl => 'compact',
> hr => 'noshade',
> img => 'ismap',
> ! input => { checked => 1, readonly => 1, disabled => 1 },
> menu => 'compact',
> ol => 'compact',
> option => 'selected',
> ***************
> *** 168,174 ****
> next if /^_/;
> my $val = $self->{$_};
> if ($_ eq $val &&
> ! exists($boolean_attr{$name}) && $boolean_attr{$name} eq $_) {
> $tag .= " \U$_";
> } else {
> if ($val !~ /^\d+$/) {
> --- 168,176 ----
> next if /^_/;
> my $val = $self->{$_};
> if ($_ eq $val &&
> ! exists($boolean_attr{$name}) &&
> ! (ref($boolean_attr{$name}) ? $boolean_attr{$name}{$_} :
> ! $boolean_attr{$name} eq $_)) {
> $tag .= " \U$_";
> } else {
> if ($val !~ /^\d+$/) {