From 442d43e323b0b6cc4bfb5ee322d6d3cc5f4030e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 17 Jan 2012 13:45:46 +0100 Subject: [PATCH] L: HTML Attribute ohne Wert korrekt generieren. --- SL/Template/Plugin/L.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) : ''; -- 2.20.1