@@ -214,8 +214,8 @@ $.extend(Datepicker.prototype, {
214214 return ;
215215 }
216216 this . _attachments ( input , inst ) ;
217- input . addClass ( this . markerClassName ) . keydown ( this . _doKeyDown ) .
218- keypress ( this . _doKeyPress ) . keyup ( this . _doKeyUp ) ;
217+ input . addClass ( this . markerClassName ) . on ( "keydown" , this . _doKeyDown ) .
218+ on ( "keypress" , this . _doKeyPress ) . on ( "keyup" , this . _doKeyUp ) ;
219219 this . _autoSize ( inst ) ;
220220 $ . data ( target , "datepicker" , inst ) ;
221221 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
@@ -238,15 +238,15 @@ $.extend(Datepicker.prototype, {
238238 input [ isRTL ? "before" : "after" ] ( inst . append ) ;
239239 }
240240
241- input . unbind ( "focus" , this . _showDatepicker ) ;
241+ input . off ( "focus" , this . _showDatepicker ) ;
242242
243243 if ( inst . trigger ) {
244244 inst . trigger . remove ( ) ;
245245 }
246246
247247 showOn = this . _get ( inst , "showOn" ) ;
248248 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
249- input . focus ( this . _showDatepicker ) ;
249+ input . on ( "focus" , this . _showDatepicker ) ;
250250 }
251251 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
252252 buttonText = this . _get ( inst , "buttonText" ) ;
@@ -258,7 +258,7 @@ $.extend(Datepicker.prototype, {
258258 html ( ! buttonImage ? buttonText : $ ( "<img/>" ) . attr (
259259 { src :buttonImage , alt :buttonText , title :buttonText } ) ) ) ;
260260 input [ isRTL ? "before" : "after" ] ( inst . trigger ) ;
261- inst . trigger . click ( function ( ) {
261+ inst . trigger . on ( "click" , function ( ) {
262262 if ( $ . datepicker . _datepickerShowing && $ . datepicker . _lastInput === input [ 0 ] ) {
263263 $ . datepicker . _hideDatepicker ( ) ;
264264 } else if ( $ . datepicker . _datepickerShowing && $ . datepicker . _lastInput !== input [ 0 ] ) {
@@ -339,7 +339,7 @@ $.extend(Datepicker.prototype, {
339339 id = "dp" + this . uuid ;
340340 this . _dialogInput = $ ( "<input type='text' id='" + id +
341341 "' style='position: absolute; top: -100px; width: 0px;'/>" ) ;
342- this . _dialogInput . keydown ( this . _doKeyDown ) ;
342+ this . _dialogInput . on ( "keydown" , this . _doKeyDown ) ;
343343 $ ( "body" ) . append ( this . _dialogInput ) ;
344344 inst = this . _dialogInst = this . _newInst ( this . _dialogInput , false ) ;
345345 inst . settings = { } ;
@@ -390,10 +390,10 @@ $.extend(Datepicker.prototype, {
390390 inst . append . remove ( ) ;
391391 inst . trigger . remove ( ) ;
392392 $target . removeClass ( this . markerClassName ) .
393- unbind ( "focus" , this . _showDatepicker ) .
394- unbind ( "keydown" , this . _doKeyDown ) .
395- unbind ( "keypress" , this . _doKeyPress ) .
396- unbind ( "keyup" , this . _doKeyUp ) ;
393+ off ( "focus" , this . _showDatepicker ) .
394+ off ( "keydown" , this . _doKeyDown ) .
395+ off ( "keypress" , this . _doKeyPress ) .
396+ off ( "keyup" , this . _doKeyUp ) ;
397397 } else if ( nodeName === "div" || nodeName === "span" ) {
398398 $target . removeClass ( this . markerClassName ) . empty ( ) ;
399399 }
@@ -798,7 +798,7 @@ $.extend(Datepicker.prototype, {
798798 }
799799
800800 if ( $ . datepicker . _shouldFocusInput ( inst ) ) {
801- inst . input . focus ( ) ;
801+ inst . input . trigger ( "focus" ) ;
802802 }
803803
804804 $ . datepicker . _curInst = inst ;
@@ -832,7 +832,7 @@ $.extend(Datepicker.prototype, {
832832 "Class" ] ( "ui-datepicker-rtl" ) ;
833833
834834 if ( inst === $ . datepicker . _curInst && $ . datepicker . _datepickerShowing && $ . datepicker . _shouldFocusInput ( inst ) ) {
835- inst . input . focus ( ) ;
835+ inst . input . trigger ( "focus" ) ;
836836 }
837837
838838 // deffered render of the years select (to avoid flashes on Firefox)
@@ -941,7 +941,7 @@ $.extend(Datepicker.prototype, {
941941
942942 /* Tidy up after a dialog display. */
943943 _tidyDialog : function ( inst ) {
944- inst . dpDiv . removeClass ( this . _dialogClass ) . unbind ( ".ui-datepicker-calendar" ) ;
944+ inst . dpDiv . removeClass ( this . _dialogClass ) . off ( ".ui-datepicker-calendar" ) ;
945945 } ,
946946
947947 /* Close date picker if clicked elsewhere. */
@@ -1058,7 +1058,7 @@ $.extend(Datepicker.prototype, {
10581058 this . _hideDatepicker ( ) ;
10591059 this . _lastInput = inst . input [ 0 ] ;
10601060 if ( typeof ( inst . input [ 0 ] ) !== "object" ) {
1061- inst . input . focus ( ) ; // restore focus
1061+ inst . input . trigger ( "focus" ) ; // restore focus
10621062 }
10631063 this . _lastInput = null ;
10641064 }
@@ -1624,7 +1624,7 @@ $.extend(Datepicker.prototype, {
16241624 return false ;
16251625 }
16261626 } ;
1627- $ ( this ) . bind ( this . getAttribute ( "data-event" ) , handler [ this . getAttribute ( "data-handler" ) ] ) ;
1627+ $ ( this ) . on ( this . getAttribute ( "data-event" ) , handler [ this . getAttribute ( "data-handler" ) ] ) ;
16281628 } ) ;
16291629 } ,
16301630
@@ -2007,7 +2007,7 @@ $.extend(Datepicker.prototype, {
20072007 */
20082008function datepicker_bindHover ( dpDiv ) {
20092009 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a" ;
2010- return dpDiv . delegate ( selector , "mouseout" , function ( ) {
2010+ return dpDiv . on ( "mouseout" , selector , function ( ) {
20112011 $ ( this ) . removeClass ( "ui-state-hover" ) ;
20122012 if ( this . className . indexOf ( "ui-datepicker-prev" ) !== - 1 ) {
20132013 $ ( this ) . removeClass ( "ui-datepicker-prev-hover" ) ;
@@ -2016,7 +2016,7 @@ function datepicker_bindHover(dpDiv) {
20162016 $ ( this ) . removeClass ( "ui-datepicker-next-hover" ) ;
20172017 }
20182018 } )
2019- . delegate ( selector , "mouseover" , datepicker_handleMouseover ) ;
2019+ . on ( "mouseover" , selector , datepicker_handleMouseover ) ;
20202020}
20212021
20222022function datepicker_handleMouseover ( ) {
@@ -2056,7 +2056,7 @@ $.fn.datepicker = function(options){
20562056
20572057 /* Initialise the date picker. */
20582058 if ( ! $ . datepicker . initialized ) {
2059- $ ( document ) . mousedown ( $ . datepicker . _checkExternalClick ) ;
2059+ $ ( document ) . on ( "mousedown" , $ . datepicker . _checkExternalClick ) ;
20602060 $ . datepicker . initialized = true ;
20612061 }
20622062
0 commit comments