aboutsummaryrefslogtreecommitdiffstats
path: root/ui/core.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-03-09 16:03:22 -0400
committerScott González <scott.gonzalez@gmail.com>2016-06-09 12:08:56 -0400
commit2256eeda45c0f52df87ee2241a88b3d70e83711e (patch)
treecef7ee7c36ae27e9f662cd58359b72f4323dcd74 /ui/core.js
parentd86df4b697b73c0e5ba971a912ae6d0b0385d512 (diff)
downloadjquery-ui-2256eeda45c0f52df87ee2241a88b3d70e83711e.tar.gz
jquery-ui-2256eeda45c0f52df87ee2241a88b3d70e83711e.zip
Core: Add methods to work around IE active element bugs
Closes gh-1478 (cherry picked from commit f33027840cdac5152599da66635981bbe68c6bda)
Diffstat (limited to 'ui/core.js')
-rw-r--r--ui/core.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/core.js b/ui/core.js
index 0b2e03950..40703d73d 100644
--- a/ui/core.js
+++ b/ui/core.js
@@ -43,6 +43,31 @@ $.extend( $.ui, {
SPACE: 32,
TAB: 9,
UP: 38
+ },
+
+ // Internal use only
+ safeActiveElement: function( document ) {
+ var activeElement;
+
+ // Support: IE 9 only
+ // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
+ try {
+ activeElement = document.activeElement;
+ } catch ( error ) {
+ activeElement = document.body;
+ }
+
+ return activeElement;
+ },
+
+ // Internal use only
+ safeBlur: function( element ) {
+
+ // Support: IE9 - 10 only
+ // If the <body> is blurred, IE will switch windows, see #9420
+ if ( element && element.nodeName.toLowerCase() !== "body" ) {
+ $( element ).blur();
+ }
}
});