File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,13 +40,26 @@ exports.returnFocus = function() {
4040
4141exports . setupScopedFocus = function ( element ) {
4242 modalElement = element ;
43- window . addEventListener ( 'blur' , handleBlur , false ) ;
44- document . addEventListener ( 'focus' , handleFocus , true ) ;
43+
44+ if ( window . addEventListener ) {
45+ window . addEventListener ( 'blur' , handleBlur , false ) ;
46+ document . addEventListener ( 'focus' , handleFocus , true ) ;
47+ } else {
48+ window . attachEvent ( 'onBlur' , handleBlur ) ;
49+ document . attachEvent ( 'onFocus' , handleFocus ) ;
50+ }
4551} ;
4652
4753exports . teardownScopedFocus = function ( ) {
4854 modalElement = null ;
49- window . removeEventListener ( 'blur' , handleBlur ) ;
50- document . removeEventListener ( 'focus' , handleFocus ) ;
55+
56+ if ( window . addEventListener ) {
57+ window . removeEventListener ( 'blur' , handleBlur ) ;
58+ document . removeEventListener ( 'focus' , handleFocus ) ;
59+ } else {
60+ window . detachEvent ( 'onBlur' , handleBlur ) ;
61+ document . detachEvent ( 'onFocus' , handleFocus ) ;
62+ }
5163} ;
5264
65+
You can’t perform that action at this time.
0 commit comments