From 92cd7f34b07e86062f2c024039e3309768b48ce6 Mon Sep 17 00:00:00 2001
From: Andy Wermke <andy@dev.next-step-software.com>
Date: Thu, 04 Apr 2013 10:10:23 -0400
Subject: [PATCH] Merge branch 'master' of https://github.com/roundcube/roundcubemail

---
 program/js/common.js |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/program/js/common.js b/program/js/common.js
index f9e945c..f7c0a75 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -717,13 +717,15 @@
 // jQuery plugin to emulate HTML5 placeholder attributes on input elements
 jQuery.fn.placeholder = function(text) {
   return this.each(function() {
-    var elem = $(this);
+    var active = false, 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,7 +742,9 @@
         elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
       });
 
-      if (this != document.activeElement) // Do not blur currently focused element
+      // Do not blur currently focused element (catch exception: #1489008)
+      try { active = this == document.activeElement; } catch(e) {}
+      if (!active)
         elem.blur();
     }
   });

--
Gitblit v1.9.1