aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2013-04-08 21:33:25 -0400
committerDave Methvin <dave.methvin@gmail.com>2013-04-08 21:35:48 -0400
commit85fc5878b3c6af73f42d61eedf73013e7faae408 (patch)
tree9757c54d8d883abf16dedd0376809eeb0ecbac84 /src
parentf1ba486ee3faeb70faeec1688b79ed085dd6a102 (diff)
downloadjquery-85fc5878b3c6af73f42d61eedf73013e7faae408.tar.gz
jquery-85fc5878b3c6af73f42d61eedf73013e7faae408.zip
Fix #13393. Avoid IE9 activeElement of death.
Diffstat (limited to 'src')
-rw-r--r--src/event.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/event.js b/src/event.js
index 2c9b55514..97a408839 100644
--- a/src/event.js
+++ b/src/event.js
@@ -11,6 +11,12 @@ function returnFalse() {
return false;
}
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
@@ -522,7 +528,7 @@ jQuery.event = {
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
- if ( this !== document.activeElement && this.focus ) {
+ if ( this !== safeActiveElement() && this.focus ) {
this.focus();
return false;
}
@@ -531,7 +537,7 @@ jQuery.event = {
},
blur: {
trigger: function() {
- if ( this === document.activeElement && this.blur ) {
+ if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}