From b539f205e14c167524e51adc64d8f10551c0d71f Mon Sep 17 00:00:00 2001 From: James Sumners Date: Mon, 20 Feb 2012 09:05:55 -0500 Subject: [PATCH] 1) Added json2.js so that the JSON object is always defined 2) Added JSHint pre-processor option for the JSON object 3) Corrected JSHint errors --- demo.html | 1 + in_place_edit.js | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/demo.html b/demo.html index 157af9e..912104e 100644 --- a/demo.html +++ b/demo.html @@ -4,6 +4,7 @@ Demo for In Place Edit + diff --git a/in_place_edit.js b/in_place_edit.js index a5ade64..3cba36a 100644 --- a/in_place_edit.js +++ b/in_place_edit.js @@ -1,3 +1,4 @@ +/*global JSON:false */ /** * * @fileOverview In place edit allows HTML inputs to submit to the server without the need @@ -61,7 +62,7 @@ blur: function() { var blurFunction = function() { var currentData = $form.serializeArray(); - if (JSON.stringify(formData) != JSON.stringify(currentData)) { + if (JSON.stringify(formData) !== JSON.stringify(currentData)) { $form.trigger('submit'); } }, @@ -116,7 +117,7 @@ if (code === 13) { evt.preventDefault(); currentData = $form.serializeArray(); - if (JSON.stringify(formData) != JSON.stringify(currentData)) { + if (JSON.stringify(formData) !== JSON.stringify(currentData)) { $form.trigger('submit'); } formData = currentData; @@ -234,7 +235,7 @@ timer; blurFunction = function() { - $form.hide() + $form.hide(); }; timer = setTimeout(blurFunction, 100); @@ -376,7 +377,7 @@ $this.find('.ui-autocomplete-input').on({ autocompleteselect: function(evt, ui) { $(this).val(ui.item.value); - if (JSON.stringify(formData) != JSON.stringify($form.serializeArray())) { + if (JSON.stringify(formData) !== JSON.stringify($form.serializeArray())) { $form.trigger('submit'); } },