From 6d47bc9391a8fff347db631fa52f93e5f3e0ae51 Mon Sep 17 00:00:00 2001 From: Z Date: Tue, 3 Apr 2018 23:38:14 +0800 Subject: [PATCH] Fix: Serializing the value of empty DOM elements using native JSON in IE8 See: https://blogs.msdn.microsoft.com/jscript/2009/06/22/serializing-the-value-of-empty-dom-elements-using-native-json-in-ie8/ --- jquery.placeholder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.placeholder.js b/jquery.placeholder.js index f98f380..2555818 100644 --- a/jquery.placeholder.js +++ b/jquery.placeholder.js @@ -71,10 +71,10 @@ var $passwordInput = $element.data('placeholder-password'); if ($passwordInput) { - return $passwordInput[0].value; + return $passwordInput[0].value === '' ? '' : $passwordInput[0].value; } - return $element.data('placeholder-enabled') && $element.hasClass(settings.customClass) ? '' : element.value; + return $element.data('placeholder-enabled') && $element.hasClass(settings.customClass) ? '' : (element.value === '' ? '' : element.value); }, 'set': function(element, value) {