aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/datepicker/animation.html2
-rw-r--r--demos/datepicker/date-formats.html2
-rw-r--r--demos/datepicker/localization.html2
-rw-r--r--tests/unit/datepicker/core.js2
-rw-r--r--tests/unit/datepicker/events.js8
-rw-r--r--tests/unit/datepicker/options.js12
-rw-r--r--ui/datepicker.js36
7 files changed, 32 insertions, 32 deletions
diff --git a/demos/datepicker/animation.html b/demos/datepicker/animation.html
index 990fd6262..36860cb42 100644
--- a/demos/datepicker/animation.html
+++ b/demos/datepicker/animation.html
@@ -19,7 +19,7 @@
<script>
$(function() {
$( "#datepicker" ).datepicker();
- $( "#anim" ).change(function() {
+ $( "#anim" ).on( "change", function() {
$( "#datepicker" ).datepicker( "option", "showAnim", $( this ).val() );
});
});
diff --git a/demos/datepicker/date-formats.html b/demos/datepicker/date-formats.html
index 39be9aa15..5664beb5b 100644
--- a/demos/datepicker/date-formats.html
+++ b/demos/datepicker/date-formats.html
@@ -12,7 +12,7 @@
<script>
$(function() {
$( "#datepicker" ).datepicker();
- $( "#format" ).change(function() {
+ $( "#format" ).on( "change", function() {
$( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() );
});
});
diff --git a/demos/datepicker/localization.html b/demos/datepicker/localization.html
index 2761dd31b..72933f011 100644
--- a/demos/datepicker/localization.html
+++ b/demos/datepicker/localization.html
@@ -16,7 +16,7 @@
<script>
$(function() {
$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
- $( "#locale" ).change(function() {
+ $( "#locale" ).on( "change", function() {
$( "#datepicker" ).datepicker( "option",
$.datepicker.regional[ $( this ).val() ] );
});
diff --git a/tests/unit/datepicker/core.js b/tests/unit/datepicker/core.js
index f6e0dd58f..446f6757e 100644
--- a/tests/unit/datepicker/core.js
+++ b/tests/unit/datepicker/core.js
@@ -8,7 +8,7 @@ define( [
module( "datepicker: core", {
setup: function() {
- $( "body" ).focus();
+ $( "body" ).trigger( "focus" );
}
});
diff --git a/tests/unit/datepicker/events.js b/tests/unit/datepicker/events.js
index ea69c1aaa..634fb6b79 100644
--- a/tests/unit/datepicker/events.js
+++ b/tests/unit/datepicker/events.js
@@ -137,14 +137,14 @@ test("beforeShowDay-getDate", function() {
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>January&#xa0;2010</span>" ).text(), "Initial month");
- $("a.ui-datepicker-next", dp).click();
- $("a.ui-datepicker-next", dp).click();
+ $("a.ui-datepicker-next", dp).trigger( "click" );
+ $("a.ui-datepicker-next", dp).trigger( "click" );
// contains non-breaking space
equal($("div.ui-datepicker-title").text(),
$( "<span>March&#xa0;2010</span>" ).text(), "After next clicks");
inp.datepicker("hide").datepicker("show");
- $("a.ui-datepicker-prev", dp).click();
- $("a.ui-datepicker-prev", dp).click();
+ $("a.ui-datepicker-prev", dp).trigger( "click" );
+ $("a.ui-datepicker-prev", dp).trigger( "click" );
// contains non-breaking space
equal($("div.ui-datepicker-title").text(),
$( "<span>November&#xa0;2009</span>" ).text(), "After prev clicks");
diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js
index c8a30678b..573b29b32 100644
--- a/tests/unit/datepicker/options.js
+++ b/tests/unit/datepicker/options.js
@@ -154,9 +154,9 @@ test("change", function() {
testHelper.onFocus( inp, function() {
ok( !dp.is( ":visible" ), "Button - not rendered on focus" );
- button.click();
+ button.trigger( "click" );
ok( dp.is( ":visible" ), "Button - rendered on button click" );
- button.click();
+ button.trigger( "click" );
ok( !dp.is( ":visible" ), "Button - hidden on second button click" );
inp.datepicker( "hide" ).datepicker( "destroy" );
@@ -183,9 +183,9 @@ test("change", function() {
testHelper.onFocus( inp, function() {
ok( !dp.is( ":visible" ), "Image button - not rendered on focus" );
- image.click();
+ image.trigger( "click" );
ok( dp.is( ":visible" ), "Image button - rendered on image click" );
- image.click();
+ image.trigger( "click" );
ok( !dp.is( ":visible" ), "Image button - hidden on second image click" );
inp.datepicker( "hide" ).datepicker( "destroy" );
@@ -214,9 +214,9 @@ test("change", function() {
ok( dp.is( ":visible" ), "Both - rendered on focus" );
body.simulate( "mousedown", {} );
ok( !dp.is( ":visible" ), "Both - hidden on external click" );
- button.click();
+ button.trigger( "click" );
ok( dp.is( ":visible" ), "Both - rendered on button click" );
- button.click();
+ button.trigger( "click" );
ok( !dp.is( ":visible" ), "Both - hidden on second button click" );
inp.datepicker( "hide" ).datepicker( "destroy" );
diff --git a/ui/datepicker.js b/ui/datepicker.js
index 5be0c6f0f..cf63cbb20 100644
--- a/ui/datepicker.js
+++ b/ui/datepicker.js
@@ -214,8 +214,8 @@ $.extend(Datepicker.prototype, {
return;
}
this._attachments(input, inst);
- input.addClass(this.markerClassName).keydown(this._doKeyDown).
- keypress(this._doKeyPress).keyup(this._doKeyUp);
+ input.addClass(this.markerClassName).on( "keydown", this._doKeyDown).
+ on( "keypress", this._doKeyPress).on( "keyup", this._doKeyUp);
this._autoSize(inst);
$.data(target, "datepicker", inst);
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
@@ -238,7 +238,7 @@ $.extend(Datepicker.prototype, {
input[isRTL ? "before" : "after"](inst.append);
}
- input.unbind("focus", this._showDatepicker);
+ input.off("focus", this._showDatepicker);
if (inst.trigger) {
inst.trigger.remove();
@@ -246,7 +246,7 @@ $.extend(Datepicker.prototype, {
showOn = this._get(inst, "showOn");
if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
- input.focus(this._showDatepicker);
+ input.on( "focus", this._showDatepicker );
}
if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
buttonText = this._get(inst, "buttonText");
@@ -258,7 +258,7 @@ $.extend(Datepicker.prototype, {
html(!buttonImage ? buttonText : $("<img/>").attr(
{ src:buttonImage, alt:buttonText, title:buttonText })));
input[isRTL ? "before" : "after"](inst.trigger);
- inst.trigger.click(function() {
+ inst.trigger.on( "click", function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
$.datepicker._hideDatepicker();
} else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
@@ -339,7 +339,7 @@ $.extend(Datepicker.prototype, {
id = "dp" + this.uuid;
this._dialogInput = $("<input type='text' id='" + id +
"' style='position: absolute; top: -100px; width: 0px;'/>");
- this._dialogInput.keydown(this._doKeyDown);
+ this._dialogInput.on( "keydown", this._doKeyDown );
$("body").append(this._dialogInput);
inst = this._dialogInst = this._newInst(this._dialogInput, false);
inst.settings = {};
@@ -390,10 +390,10 @@ $.extend(Datepicker.prototype, {
inst.append.remove();
inst.trigger.remove();
$target.removeClass(this.markerClassName).
- unbind("focus", this._showDatepicker).
- unbind("keydown", this._doKeyDown).
- unbind("keypress", this._doKeyPress).
- unbind("keyup", this._doKeyUp);
+ off("focus", this._showDatepicker).
+ off("keydown", this._doKeyDown).
+ off("keypress", this._doKeyPress).
+ off("keyup", this._doKeyUp);
} else if (nodeName === "div" || nodeName === "span") {
$target.removeClass(this.markerClassName).empty();
}
@@ -798,7 +798,7 @@ $.extend(Datepicker.prototype, {
}
if ( $.datepicker._shouldFocusInput( inst ) ) {
- inst.input.focus();
+ inst.input.trigger( "focus" );
}
$.datepicker._curInst = inst;
@@ -832,7 +832,7 @@ $.extend(Datepicker.prototype, {
"Class"]("ui-datepicker-rtl");
if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
- inst.input.focus();
+ inst.input.trigger( "focus" );
}
// deffered render of the years select (to avoid flashes on Firefox)
@@ -941,7 +941,7 @@ $.extend(Datepicker.prototype, {
/* Tidy up after a dialog display. */
_tidyDialog: function(inst) {
- inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
+ inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar");
},
/* Close date picker if clicked elsewhere. */
@@ -1058,7 +1058,7 @@ $.extend(Datepicker.prototype, {
this._hideDatepicker();
this._lastInput = inst.input[0];
if (typeof(inst.input[0]) !== "object") {
- inst.input.focus(); // restore focus
+ inst.input.trigger( "focus" ); // restore focus
}
this._lastInput = null;
}
@@ -1624,7 +1624,7 @@ $.extend(Datepicker.prototype, {
return false;
}
};
- $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
+ $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
});
},
@@ -2007,7 +2007,7 @@ $.extend(Datepicker.prototype, {
*/
function datepicker_bindHover(dpDiv) {
var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
- return dpDiv.delegate(selector, "mouseout", function() {
+ return dpDiv.on( "mouseout", selector, function() {
$(this).removeClass("ui-state-hover");
if (this.className.indexOf("ui-datepicker-prev") !== -1) {
$(this).removeClass("ui-datepicker-prev-hover");
@@ -2016,7 +2016,7 @@ function datepicker_bindHover(dpDiv) {
$(this).removeClass("ui-datepicker-next-hover");
}
})
- .delegate( selector, "mouseover", datepicker_handleMouseover );
+ .on( "mouseover", selector, datepicker_handleMouseover );
}
function datepicker_handleMouseover() {
@@ -2056,7 +2056,7 @@ $.fn.datepicker = function(options){
/* Initialise the date picker. */
if (!$.datepicker.initialized) {
- $(document).mousedown($.datepicker._checkExternalClick);
+ $(document).on( "mousedown", $.datepicker._checkExternalClick );
$.datepicker.initialized = true;
}