From b1259745cda7268263b0478c0208b76b585be6e4 Mon Sep 17 00:00:00 2001 From: Justin Bozonier Date: Thu, 8 Dec 2011 06:30:31 -0800 Subject: [PATCH 1/3] Added support for maxlength. --- jquery.jeditable.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jquery.jeditable.js b/jquery.jeditable.js index eb8a911..38fd99f 100644 --- a/jquery.jeditable.js +++ b/jquery.jeditable.js @@ -457,6 +457,9 @@ /* https://bugzilla.mozilla.org/show_bug.cgi?id=236791 */ //input[0].setAttribute('autocomplete','off'); input.attr('autocomplete','off'); + if (settings.maxlength) { + input.attr('maxlength', settings.maxlength); + } $(this).append(input); return(input); } From 8bf64aab5de23242e42fc950861a56cdb00d878c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Dec 2011 16:23:02 -0800 Subject: [PATCH 2/3] merging html=> text fix https://github.com/davidchambers/jquery_jeditable/commit/3b65bc6df097dde79ca9f40f55babdbf9882c7a3 --- jquery.jeditable.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.jeditable.js b/jquery.jeditable.js index 38fd99f..a194bb4 100644 --- a/jquery.jeditable.js +++ b/jquery.jeditable.js @@ -171,7 +171,7 @@ } self.editing = true; - self.revert = $(self).html(); + self.revert = $(self).text(); $(self).html(''); /* Create the form object. */ @@ -309,7 +309,7 @@ /* Check if given target is function */ if ($.isFunction(settings.target)) { var str = settings.target.apply(self, [input.val(), settings]); - $(self).html(str); + $(self).text(str); self.editing = false; callback.apply(self, [self.innerHTML, settings]); /* TODO: this is not dry */ @@ -378,7 +378,7 @@ if (this.editing) { /* Before reset hook, if it returns false abort reseting. */ if (false !== onreset.apply(form, [settings, self])) { - $(self).html(self.revert); + $(self).text(self.revert); self.editing = false; if (!$.trim($(self).html())) { $(self).html(settings.placeholder); From a6e8463809341f6e1f0b552bc78b9f6fc020899b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Dec 2011 16:27:59 -0800 Subject: [PATCH 3/3] Fix for clicking cancel submitting the form in onblur: 'submit' mode. (same issue as here, but different fix: https://github.com/tuupola/jquery_jeditable/pull/31) --- jquery.jeditable.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jquery.jeditable.js b/jquery.jeditable.js index a194bb4..4d4dd26 100644 --- a/jquery.jeditable.js +++ b/jquery.jeditable.js @@ -176,6 +176,7 @@ /* Create the form object. */ var form = $('
'); + form[0].isReset = false; /* Apply css or style or both. */ if (settings.cssclass) { @@ -277,7 +278,9 @@ input.blur(function(e) { /* Prevent double submit if submit was clicked. */ t = setTimeout(function() { - form.submit(); + if (!form[0].isReset) { + form.submit(); + } }, 200); }); } else if ($.isFunction(settings.onblur)) { @@ -378,6 +381,7 @@ if (this.editing) { /* Before reset hook, if it returns false abort reseting. */ if (false !== onreset.apply(form, [settings, self])) { + $("form", self)[0].isReset = true; $(self).text(self.revert); self.editing = false; if (!$.trim($(self).html())) {