[BUGFIX] Don't trigger clearable on ENTER 64/36964/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 17 Feb 2015 08:36:29 +0000 (09:36 +0100)
committerXavier Perseguers <xavier@typo3.org>
Tue, 17 Feb 2015 09:49:18 +0000 (10:49 +0100)
Add a type="button" to the clearable button to prevent trigger stealing
by pressing enter in it's input field.

Resolves: #65079
Releases: master
Change-Id: I5009f94839587c5918e23167a190e67cf4043f53
Reviewed-on: http://review.typo3.org/36964
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/contrib/jquery/jquery.clearable.js

index 69ba899..1d9efd8 100644 (file)
@@ -45,7 +45,7 @@
                                // Wrap it with a div and add a span that is the trigger for
                                // clearing.
                                $input.wrap('<div class="form-control-clearable" />');
-                               $input.after('<button class="close"><span class="fa fa-times" /></button>');
+                               $input.after('<button type="button" class="close"><span class="fa fa-times" /></button>');
                                $input.addClass('t3js-clearable');
 
                                var $clearer = $input.next();
@@ -53,7 +53,7 @@
                                // Register a listener the various events triggering the clearer to
                                // be shown or hidden.
                                var handler = function() {
-                                       $element = $(this);
+                                       var $element = $(this);
                                        if ($element.next('input[type=hidden]').length) {
                                                $element = $element.next('input[type=hidden]');
                                        }