From 3d58a31ea82a69fc2b02d8239414697cc3ad7d1a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 20 Jan 2017 12:36:52 +0100 Subject: [PATCH] CustomerVendorPicker: Strict-Modus & Warnungen von jshint beseitigt --- js/autocomplete_customer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/autocomplete_customer.js b/js/autocomplete_customer.js index a42a70952..3d6b426fe 100644 --- a/js/autocomplete_customer.js +++ b/js/autocomplete_customer.js @@ -1,4 +1,6 @@ namespace('kivi', function(k){ + "use strict"; + k.CustomerVendorPicker = function($real, options) { // short circuit in case someone double inits us if ($real.data("customer_vendor_picker")) @@ -80,7 +82,7 @@ namespace('kivi', function(k){ if (state == STATES.PICKED) { annotate_state(); return true - } else if (state == STATES.UNDEFINED && $dummy.val() == '') + } else if (state == STATES.UNDEFINED && $dummy.val() === '') set_item({}) else { last_unverified_dummy = $dummy.val(); @@ -92,7 +94,7 @@ namespace('kivi', function(k){ function annotate_state () { if (state == STATES.PICKED) $dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); - else if (state == STATES.UNDEFINED && $dummy.val() == '') + else if (state == STATES.UNDEFINED && $dummy.val() === '') $dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED); else { last_unverified_dummy = $dummy.val(); @@ -119,7 +121,7 @@ namespace('kivi', function(k){ annotate_state(); } }); - }; + } $dummy.autocomplete({ source: function(req, rsp) { @@ -149,7 +151,7 @@ namespace('kivi', function(k){ $dummy.keydown(function(event){ if (event.which == KEY.ENTER || event.which == KEY.TAB) { // if string is empty assume they want to delete - if ($dummy.val() == '') { + if ($dummy.val() === '') { set_item({}); return true; } else if (state == STATES.PICKED) { -- 2.20.1