Bug 35012: Apply change to all events
We should not just look at Click. Test plan: [1] Apply the example patch for a Blur action in barcode.pl. [2] Check that barcode.pl is active in your framework and that autoBarcode is not disabled. [3] Open the browser dev console. [4] Tab a few times through barcode in the neworderempty form of Acquisition. If you leave the field, the Blur event fires. => Without this patch you will see two console lines (FF may show a little '2' icon at the right side) added. With this patch just one. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jan Kissig <jkissig@th-wildau.de> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commite9326f0e86
) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commitc8685d088a
) Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
parent
ca7f2208ce
commit
75b85ddb29
1 changed files with 5 additions and 13 deletions
|
@ -329,21 +329,13 @@ sub _add_binding {
|
|||
#click event applies to buttonDot
|
||||
|
||||
if( $pars =~ /^(e|ev|event)$/i ) { # new style event handler assumed
|
||||
|
||||
if ($ev eq "click"){
|
||||
# remove already registered click listeners
|
||||
$bind= qq| \$("#$ctl").off('click');\n|;
|
||||
$bind.= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|;
|
||||
} else {
|
||||
$bind= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|;
|
||||
}
|
||||
|
||||
$script='';
|
||||
$bind = qq| \$("#$ctl").off('$ev').on('$ev', \{id: '$id'\}, $fname);\n|; # remove old handler if any
|
||||
$script = q{};
|
||||
} elsif( $fname eq 'noclick' ) { # no click: return false, no scroll
|
||||
$bind= qq| \$("#$ctl").$ev(function () { return false; });\n|;
|
||||
$script='';
|
||||
$bind = qq| \$("#$ctl").$ev(function () { return false; });\n|;
|
||||
$script = q{};
|
||||
} else { # add real event handler calling the function found
|
||||
$bind=qq| \$("#$ctl").$ev(\{id: '$id'\}, ${fname}_handler);\n|;
|
||||
$bind = qq| \$("#$ctl").off('$ev').on('$ev', \{id: '$id'\}, ${fname}_handler);\n|;
|
||||
$script = $self->_add_handler( $ev, $fname );
|
||||
}
|
||||
return ( $bind, $script );
|
||||
|
|
Loading…
Reference in a new issue