Skip to content

Commit

Permalink
1) Added json2.js so that the JSON object is always defined
Browse files Browse the repository at this point in the history
2) Added JSHint pre-processor option for the JSON object
3) Corrected JSHint errors
  • Loading branch information
jsumners authored and bencates committed Mar 11, 2012
1 parent 135bbe6 commit b539f20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions demo.html
Expand Up @@ -4,6 +4,7 @@
<html>
<head>
<title>Demo for In Place Edit</title>
<script type="text/javascript" src="https://github.com/douglascrockford/JSON-js/raw/master/json2.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
Expand Down
9 changes: 5 additions & 4 deletions 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
Expand Down Expand Up @@ -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');
}
},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -234,7 +235,7 @@
timer;

blurFunction = function() {
$form.hide()
$form.hide();
};

timer = setTimeout(blurFunction, 100);
Expand Down Expand Up @@ -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');
}
},
Expand Down

0 comments on commit b539f20

Please sign in to comment.