From f8d97cdc31938ca25b354f4a47eabf62a96fd181 Mon Sep 17 00:00:00 2001 From: James Allardice Date: Fri, 29 Nov 2013 08:16:06 +0000 Subject: [PATCH] Make sure the value of maxlength is valid (see #56) --- lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index 304608c..b9c8a9b 100644 --- a/lib/main.js +++ b/lib/main.js @@ -87,7 +87,7 @@ // Restore the maxlength value maxLength = elem.getAttribute(ATTR_MAXLENGTH); - if (maxLength) { + if (parseInt(maxLength, 10) >= 0) { // Old FF returns -1 if attribute not set (see GH-56) elem.setAttribute("maxLength", maxLength); elem.removeAttribute(ATTR_MAXLENGTH); }