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>2015-03-12 07:35:27 -0400
commitf33027840cdac5152599da66635981bbe68c6bda (patch)
treea52f4063e0a2aab02af24d26eee590eba797882e /ui/core.js
parent6111b17710ab4e14bb119e735de9cfa9285badab (diff)
downloadjquery-ui-f33027840cdac5152599da66635981bbe68c6bda.tar.gz
jquery-ui-f33027840cdac5152599da66635981bbe68c6bda.zip
Core: Add methods to work around IE active element bugs
Closes gh-1478
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 a7d10fe40..107bd96e9 100644
--- a/ui/core.js
+++ b/ui/core.js
@@ -49,6 +49,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();
+ }
}
});