From: Sven Schöling Date: Tue, 17 Jan 2012 12:45:46 +0000 (+0100) Subject: L: HTML Attribute ohne Wert korrekt generieren. X-Git-Tag: release-2.7.0beta1~45 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=442d43e323b0b6cc4bfb5ee322d6d3cc5f4030e8;p=kivitendo-erp.git L: HTML Attribute ohne Wert korrekt generieren. --- diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index d8d223ecb..be4b0a65a 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -17,6 +17,11 @@ sub _tag_id { } } +my %_valueless_attributes = map { $_ => 1 } qw( + checked compact declare defer disabled ismap multiple noresize noshade nowrap + readonly selected +); + sub _H { my $string = shift; return $::locale->quote_special_chars('HTML', $string); @@ -62,9 +67,9 @@ sub attributes { my @result = (); while (my ($name, $value) = each %options) { next unless $name; - next if $name eq 'disabled' && !$value; + next if $_valueless_attributes{$name} && !$value; $value = '' if !defined($value); - push @result, _H($name) . '="' . _H($value) . '"'; + push @result, $_valueless_attributes{$name} ? _H($name) : _H($name) . '="' . _H($value) . '"'; } return @result ? ' ' . join(' ', @result) : '';