Don't bother warning about TMPL_VAR if the key is onclick, onblur, etc.

We don't know how to warn/what to suggest, & that will only confuse people
This commit is contained in:
acli 2004-02-14 09:50:11 +00:00
parent 1d45c47c02
commit 2a9be2b2e6

View file

@ -107,12 +107,14 @@ sub extract_attributes ($;$) {
warn "Warning: TMPL_INCLUDE in attribute"
. (defined $lc? " near line $lc": '') . ": $val_orig\n";
} elsif ($val =~ /$re_tmpl_var/os && $val !~ /$re_tmpl_var_escaped/os) {
# FIXME: we probably should not warn if key is "onclick" etc? :-/
my $suggest = ($key =~ /^(?:action|archive|background|cite|classid|codebase|data|datasrc|for|href|longdesc|profile|src|usemap)$/? 'URL': 'HTML');
# XXX: we probably should not warn if key is "onclick" etc
# XXX: there's just no reasonable thing to suggest
my $suggest = ($key =~ /^(?:action|archive|background|cite|classid|codebase|data|datasrc|for|href|longdesc|profile|src|usemap)$/i? 'URL': 'HTML');
undef $suggest if $key =~ /^(?:onblur|onchange|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onselect|onsubmit|onunload)$/i;
warn_pedantic \$pedantic_tmpl_var_use_in_nonpedantic_mode_p,
"Suggest ESCAPE=$suggest for TMPL_VAR in attribute \"$key\""
. (defined $lc? " near line $lc": '') . ": $val_orig"
if $pedantic_p || !$pedantic_tmpl_var_use_in_nonpedantic_mode_p;
if defined $suggest && ($pedantic_p || !$pedantic_tmpl_var_use_in_nonpedantic_mode_p);
} elsif ($val_orig !~ /^['"]/) {
my $t = $val; $t =~ s/$re_directive_control//os;
warn_pedantic \$pedantic_attribute_error_in_nonpedantic_mode_p,