Revision 442d43e3
Von Sven Schöling vor fast 13 Jahren hinzugefügt
SL/Template/Plugin/L.pm | ||
---|---|---|
17 | 17 |
} |
18 | 18 |
} |
19 | 19 |
|
20 |
my %_valueless_attributes = map { $_ => 1 } qw( |
|
21 |
checked compact declare defer disabled ismap multiple noresize noshade nowrap |
|
22 |
readonly selected |
|
23 |
); |
|
24 |
|
|
20 | 25 |
sub _H { |
21 | 26 |
my $string = shift; |
22 | 27 |
return $::locale->quote_special_chars('HTML', $string); |
... | ... | |
62 | 67 |
my @result = (); |
63 | 68 |
while (my ($name, $value) = each %options) { |
64 | 69 |
next unless $name; |
65 |
next if $name eq 'disabled' && !$value;
|
|
70 |
next if $_valueless_attributes{$name} && !$value;
|
|
66 | 71 |
$value = '' if !defined($value); |
67 |
push @result, _H($name) . '="' . _H($value) . '"'; |
|
72 |
push @result, $_valueless_attributes{$name} ? _H($name) : _H($name) . '="' . _H($value) . '"';
|
|
68 | 73 |
} |
69 | 74 |
|
70 | 75 |
return @result ? ' ' . join(' ', @result) : ''; |
Auch abrufbar als: Unified diff
L: HTML Attribute ohne Wert korrekt generieren.