@@ -89,11 +89,10 @@ $.widget( "ui.popup", {
8989 case $ . ui . keyCode . UP :
9090 // prevent scrolling
9191 event . preventDefault ( ) ;
92- var that = this ;
9392 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 ) ;
9796 } , 1 ) ;
9897 break ;
9998 }
@@ -115,28 +114,26 @@ $.widget( "ui.popup", {
115114 return ;
116115 }
117116 this . open ( event ) ;
118- var that = this ;
119117 clearTimeout ( this . closeTimer ) ;
120- this . _delay ( function ( ) {
118+ this . _delay ( function ( ) {
121119 if ( ! noFocus ) {
122- that . focusPopup ( ) ;
120+ this . focusPopup ( ) ;
123121 }
124- } , 1 ) ;
122+ } , 1 ) ;
125123 }
126124 } ) ;
127125
128126 if ( this . options . expandOnFocus ) {
129127 this . _bind ( this . options . trigger , {
130128 focus : function ( event ) {
131129 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 ) ;
136133 }
137134 } , 1 ) ;
138135 }
139- setTimeout ( function ( ) {
136+ this . _delay ( function ( ) {
140137 suppressExpandOnFocus = false ;
141138 } , 100 ) ;
142139 } ,
@@ -167,11 +164,10 @@ $.widget( "ui.popup", {
167164
168165 this . _bind ( {
169166 focusout : function ( event ) {
170- var that = this ;
171167 // use a timer to allow click to clear it and letting that
172168 // 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 ) ;
175171 } , 100 ) ;
176172 } ,
177173 focusin : function ( event ) {
0 commit comments