@@ -30,6 +30,7 @@ var Search = Control.extend({
3030 keyboardActiveClass : "keyboard-active" ,
3131
3232 //search options
33+ searchAnimation : 250 , // matches @transition -speed in variables.less
3334 searchTimeout : 400 ,
3435
3536 localStorageKeyPrefix : "search" ,
@@ -85,7 +86,7 @@ var Search = Control.extend({
8586
8687 //show the search input when the search engine is ready
8788 if ( self . options . animateInOnStart ) {
88- self . $inputWrap . fadeIn ( 400 ) ;
89+ self . $inputWrap . fadeIn ( self . options . searchAnimation ) ;
8990 } else {
9091 self . $inputWrap . show ( ) ;
9192 }
@@ -472,11 +473,8 @@ var Search = Control.extend({
472473 } ,
473474
474475 //cancel search on cancel click
475- ".search-icon-cancel click" : function ( el , ev ) {
476- ev . preventDefault ( ) ;
477- ev . stopPropagation ( ) ;
478- this . clear ( ) ;
479- } ,
476+ ".search-icon-cancel click" : "clear" ,
477+ ".search-icon-cancel touchend" : "clear" ,
480478
481479 // ---- END EVENTS ---- //
482480
@@ -573,7 +571,11 @@ var Search = Control.extend({
573571 // function clear
574572 // - clears & focuses the input
575573 // - unsets the search state
576- clear : function ( ) {
574+ clear : function ( element , event ) {
575+ if ( event ) {
576+ event . preventDefault ( ) ;
577+ event . stopPropagation ( ) ;
578+ }
577579 this . $input . val ( "" ) . trigger ( "focus" ) ;
578580 this . unsetSearchState ( ) ;
579581 } ,
@@ -599,7 +601,7 @@ var Search = Control.extend({
599601 this . deactivateResult ( ) ;
600602 $ ( '#left' ) . removeClass ( 'search-showing' ) ;
601603 this . $resultsContainer . stop ( ) . addClass ( "is-hiding" ) . fadeOut ( {
602- duration : 400 ,
604+ duration : this . options . searchAnimation ,
603605 complete : function ( ) {
604606 self . $resultsContainer . removeClass ( "is-hiding" ) ;
605607 if ( ! self . $resultsContainer . is ( ".is-showing" ) ) {
@@ -626,7 +628,7 @@ var Search = Control.extend({
626628 }
627629 this . $resultsContainerParent . stop ( ) . addClass ( "search-active" ) ;
628630 this . $resultsContainer . addClass ( "is-showing" ) . fadeIn ( {
629- duration : 400 ,
631+ duration : this . options . searchAnimation ,
630632 complete : function ( ) {
631633 if ( ! self . $resultsContainer . is ( ".is-hiding" ) ) {
632634 self . $resultsContainer . removeClass ( "is-showing" ) ;
0 commit comments