Use .siblings to locate the suggestions, clear elements for efficiency (#285)

This commit is contained in:
Santhosh Thottingal
2018-01-10 12:43:56 +05:30
committed by Niklas Laxström
parent bccf103900
commit 37c9d66a2b

View File

@@ -46,8 +46,8 @@
this.options = $.extend( {}, $.fn.languagefilter.defaults, options );
this.$element.addClass( 'languagefilter' );
this.resultCount = 0;
this.$suggestion = this.$element.parents().find( '.' + this.$element.data( 'suggestion' ) );
this.$clear = this.$element.parents().find( '.' + this.$element.data( 'clear' ) );
this.$suggestion = this.$element.siblings( '.' + this.$element.data( 'suggestion' ) );
this.$clear = this.$element.siblings( '.' + this.$element.data( 'clear' ) );
this.selectedLanguage = null;
this.init();
this.listen();