Browse files

fix #974 test.aria.utils.cfgframe.AriaWindowTest failing on IE 8

Commit 2c1141e makes the following
test fail on IE 8: test.aria.utils.cfgframe.AriaWindowTest.
It only happens on a true IE 8 (not on IE 11 in IE 8 mode).

The issue comes from an "Unspecified error" raised when trying to read
Aria.$window.document.activeElement. This commit surrounds that piece
of code by a try ... catch.
  • Loading branch information...
1 parent 465099a commit eb58c963bccc5dc91b036e06cc5f87043435cfc3 @divdavem divdavem committed Feb 13, 2014
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/aria/utils/Dom.js
View
19 src/aria/utils/Dom.js
@@ -220,12 +220,19 @@ Aria.classDefinition({
}
if (domElt) {
if ((aria.core.Browser.isIE7 || aria.core.Browser.isIE8) && aria.utils && aria.utils.Delegate) {
- var activeElement = Aria.$window.document.activeElement;
- if (activeElement && this.isAncestor(activeElement, domElt)) {
- // On IE 7-8, there is an issue after removing from the DOM a focused element.
- // We detect it here so that next time there is a need to focus an element, we focus the body
- // first (which is the work-around for IE 7-8)
- aria.utils.Delegate.ieRemovingFocusedElement();
+ try {
+ var activeElement = Aria.$window.document.activeElement;
+ if (activeElement && this.isAncestor(activeElement, domElt)) {
+ // On IE 7-8, there is an issue after removing from the DOM a focused element.
+ // We detect it here so that next time there is a need to focus an element, we focus the
+ // body first (which is the work-around for IE 7-8)
+ aria.utils.Delegate.ieRemovingFocusedElement();
+ }
+ } catch (e) {
+ // on (real) IE8, an "Unspecified error" can be raised when trying to read
+ // Aria.$window.document.activeElement
+ // It happens when executing the following test: test.aria.utils.cfgframe.AriaWindowTest
+ // It does not happen with IE 11 in IE8 mode.
}
}
// PROFILING // var msr2 = this.$startMeasure("RemoveHTML");

0 comments on commit eb58c96

Please sign in to comment.