Revision 442d43e3
Von Sven Schöling vor mehr als 13 Jahren hinzugefügt
SL/Template/Plugin/L.pm | ||
---|---|---|
}
|
||
}
|
||
|
||
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);
|
||
... | ... | |
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) : '';
|
Auch abrufbar als: Unified diff
L: HTML Attribute ohne Wert korrekt generieren.