summaryrefslogtreecommitdiff
path: root/program/js/common.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-22 18:53:24 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-22 18:54:43 +0100
commit73f094ff3ca151e928e61cc20578310e44d455a3 (patch)
tree9d7bc0276ea86efa5cf221c7121d2c271504c16c /program/js/common.js
parent71cae613f0e71cb5aa5dbdf82719f5ecc694af03 (diff)
Fix javascript error in IE9 when loading form with placeholders into an iframe (#1489008)
Diffstat (limited to 'program/js/common.js')
-rw-r--r--program/js/common.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/program/js/common.js b/program/js/common.js
index f9e945c05..7ad1891ec 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -720,10 +720,12 @@ jQuery.fn.placeholder = function(text) {
var elem = $(this);
this.title = text;
+ // Try HTML5 placeholder attribute first
if ('placeholder' in this) {
- elem.attr('placeholder', text); // Try HTML5 placeholder attribute first
+ elem.attr('placeholder', text);
}
- else { // Fallback to Javascript emulation of placeholder
+ // Fallback to Javascript emulation of placeholder
+ else {
this._placeholder = text;
elem.blur(function(e) {
if ($.trim(elem.val()) == "")
@@ -740,8 +742,13 @@ jQuery.fn.placeholder = function(text) {
elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
});
- if (this != document.activeElement) // Do not blur currently focused element
- elem.blur();
+ // Do not blur currently focused element
+ // Catch "unspecified error" in IE9 (#1489008)
+ try {
+ if (this != document.activeElement)
+ elem.blur();
+ }
+ catch(e) {}
}
});
};