@@ -89,11 +89,10 @@ $.widget( "ui.popup", {
89
89
case $ . ui . keyCode . UP :
90
90
// prevent scrolling
91
91
event . preventDefault ( ) ;
92
- var that = this ;
93
92
clearTimeout ( this . closeTimer ) ;
94
- setTimeout ( function ( ) {
95
- that . open ( event ) ;
96
- that . focusPopup ( event ) ;
93
+ this . _delay ( function ( ) {
94
+ this . open ( event ) ;
95
+ this . focusPopup ( event ) ;
97
96
} , 1 ) ;
98
97
break ;
99
98
}
@@ -115,28 +114,26 @@ $.widget( "ui.popup", {
115
114
return ;
116
115
}
117
116
this . open ( event ) ;
118
- var that = this ;
119
117
clearTimeout ( this . closeTimer ) ;
120
- this . _delay ( function ( ) {
118
+ this . _delay ( function ( ) {
121
119
if ( ! noFocus ) {
122
- that . focusPopup ( ) ;
120
+ this . focusPopup ( ) ;
123
121
}
124
- } , 1 ) ;
122
+ } , 1 ) ;
125
123
}
126
124
} ) ;
127
125
128
126
if ( this . options . expandOnFocus ) {
129
127
this . _bind ( this . options . trigger , {
130
128
focus : function ( event ) {
131
129
if ( ! suppressExpandOnFocus ) {
132
- var that = this ;
133
- setTimeout ( function ( ) {
134
- if ( ! that . isOpen ) {
135
- that . open ( event ) ;
130
+ this . _delay ( function ( ) {
131
+ if ( ! this . isOpen ) {
132
+ this . open ( event ) ;
136
133
}
137
134
} , 1 ) ;
138
135
}
139
- setTimeout ( function ( ) {
136
+ this . _delay ( function ( ) {
140
137
suppressExpandOnFocus = false ;
141
138
} , 100 ) ;
142
139
} ,
@@ -167,11 +164,10 @@ $.widget( "ui.popup", {
167
164
168
165
this . _bind ( {
169
166
focusout : function ( event ) {
170
- var that = this ;
171
167
// use a timer to allow click to clear it and letting that
172
168
// handle the closing instead of opening again
173
- that . closeTimer = setTimeout ( function ( ) {
174
- that . close ( event ) ;
169
+ this . closeTimer = this . _delay ( function ( ) {
170
+ this . close ( event ) ;
175
171
} , 100 ) ;
176
172
} ,
177
173
focusin : function ( event ) {
0 commit comments