Skip to content

Commit be0a176

Browse files
committed
Dialog: Remove core event/alias and deprecated module dependencies
1 parent 183422b commit be0a176

File tree

11 files changed

+46
-44
lines changed

11 files changed

+46
-44
lines changed

demos/dialog/animated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
});
3333

34-
$( "#opener" ).click(function() {
34+
$( "#opener" ).on( "click", function() {
3535
$( "#dialog" ).dialog( "open" );
3636
});
3737
});

tests/unit/dialog/core.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ asyncTest( "focus tabbable", function() {
103103
// Support: IE8
104104
// For some reason the focus doesn't get set properly if we don't
105105
// focus the body first.
106-
$( "body" ).focus();
106+
$( "body" ).trigger( "focus" );
107107

108108
element = $( markup ).dialog( options );
109109
setTimeout(function() {
@@ -116,7 +116,7 @@ asyncTest( "focus tabbable", function() {
116116

117117
function step1() {
118118
checkFocus( "<div><input><input></div>", options, function( done ) {
119-
var input = element.find( "input:last" ).focus().blur();
119+
var input = element.find( "input:last" ).trigger( "focus" ).trigger( "blur" );
120120
element.dialog( "instance" )._focusTabbable();
121121
setTimeout(function() {
122122
equal( document.activeElement, input[ 0 ],
@@ -177,9 +177,9 @@ asyncTest( "focus tabbable", function() {
177177
{
178178
open: function() {
179179
var inputs = $( this ).find( "input" );
180-
inputs.last().keydown(function( event ) {
180+
inputs.last().on( "keydown",function( event ) {
181181
event.preventDefault();
182-
inputs.first().focus();
182+
inputs.first().trigger( "focus" );
183183
});
184184
}
185185
},
@@ -253,7 +253,7 @@ asyncTest( "#9048: multiple modal dialogs opened and closed in different order",
253253
$( "#dialog1" ).dialog( "close" );
254254
setTimeout(function() {
255255
$( "#dialog2" ).dialog( "close" );
256-
$( "#favorite-animal" ).focus();
256+
$( "#favorite-animal" ).trigger( "focus" );
257257
ok( true, "event handlers cleaned up (no errors thrown)" );
258258
start();
259259
});
@@ -277,20 +277,20 @@ asyncTest( "interaction between overlay and other dialogs", function() {
277277
// Support: IE8
278278
// For some reason the focus doesn't get set properly if we don't
279279
// focus the body first.
280-
$( "body" ).focus();
280+
$( "body" ).trigger( "focus" );
281281

282282
// Wait for the modal to init
283283
setTimeout(function() {
284284
second.testWidget( "open" );
285285

286286
// Simulate user tabbing from address bar to an element outside the dialog
287-
$( "#favorite-animal" ).focus();
287+
$( "#favorite-animal" ).trigger( "focus" );
288288
setTimeout(function() {
289289
equal( document.activeElement, secondInput[ 0 ] );
290290

291291
// Last active dialog must receive focus
292-
firstInput.focus();
293-
$( "#favorite-animal" ).focus();
292+
firstInput.trigger( "focus" );
293+
$( "#favorite-animal" ).trigger( "focus" );
294294
setTimeout(function() {
295295
equal( document.activeElement, firstInput[ 0 ] );
296296

tests/unit/dialog/events.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test("open", function() {
3030
equal(ev.type, "dialogopen", "event type in callback");
3131
deepEqual(ui, {}, "ui hash in callback");
3232
}
33-
}).bind("dialogopen", function(ev, ui) {
33+
}).on("dialogopen", function(ev, ui) {
3434
ok(element.dialog( "instance" )._isOpen, "interal _isOpen flag is set");
3535
ok(true, "dialog('open') fires open event");
3636
equal(this, element[0], "context of event");
@@ -70,7 +70,7 @@ test( "focus", function() {
7070
other.dialog( "moveToTop" );
7171
element.dialog( "moveToTop" );
7272

73-
element.bind( "dialogfocus", function() {
73+
element.on( "dialogfocus", function() {
7474
ok( true, "when mousedown anywhere on the dialog and it wasn't on top" );
7575
});
7676
other.dialog( "moveToTop" );
@@ -96,7 +96,7 @@ test("dragStart", function() {
9696
ok(ui.position !== undefined, "ui.position in callback");
9797
ok(ui.offset !== undefined, "ui.offset in callback");
9898
}
99-
}).bind("dialogdragstart", function(ev, ui) {
99+
}).on("dialogdragstart", function(ev, ui) {
100100
ok(true, "dragging fires dialogdragstart event");
101101
equal(this, element[0], "context of event");
102102
ok(ui.position !== undefined, "ui.position in callback");
@@ -148,7 +148,7 @@ test("dragStop", function() {
148148
ok(ui.position !== undefined, "ui.position in callback");
149149
ok(ui.offset !== undefined, "ui.offset in callback");
150150
}
151-
}).bind("dialogdragstop", function(ev, ui) {
151+
}).on("dialogdragstop", function(ev, ui) {
152152
ok(true, "dragging fires dialogdragstop event");
153153
equal(this, element[0], "context of event");
154154
ok(ui.position !== undefined, "ui.position in callback");
@@ -174,7 +174,7 @@ test("resizeStart", function() {
174174
ok(ui.position !== undefined, "ui.position in callback");
175175
ok(ui.size !== undefined, "ui.size in callback");
176176
}
177-
}).bind("dialogresizestart", function(ev, ui) {
177+
}).on("dialogresizestart", function(ev, ui) {
178178
ok(true, "resizing fires dialogresizestart event");
179179
equal(this, element[0], "context of event");
180180
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
@@ -234,7 +234,7 @@ test("resizeStop", function() {
234234
ok(ui.position !== undefined, "ui.position in callback");
235235
ok(ui.size !== undefined, "ui.size in callback");
236236
}
237-
}).bind("dialogresizestop", function(ev, ui) {
237+
}).on("dialogresizestop", function(ev, ui) {
238238
ok(true, "resizing fires dialogresizestop event");
239239
equal(this, element[0], "context of event");
240240
ok(ui.originalPosition !== undefined, "ui.originalPosition in callback");
@@ -258,7 +258,7 @@ asyncTest("close", function() {
258258
equal(ev.type, "dialogclose", "event type in callback");
259259
deepEqual(ui, {}, "ui hash in callback");
260260
}
261-
}).bind("dialogclose", function(ev, ui) {
261+
}).on("dialogclose", function(ev, ui) {
262262
ok(true, ".dialog('close') fires dialogclose event");
263263
equal(this, element[0], "context of event");
264264
deepEqual(ui, {}, "ui hash in event");
@@ -276,7 +276,7 @@ asyncTest("close", function() {
276276
deepEqual(ui, {}, "ui hash in callback");
277277
start();
278278
}
279-
}).bind("dialogclose", function(ev, ui) {
279+
}).on("dialogclose", function(ev, ui) {
280280
ok(true, ".dialog('close') fires dialogclose event");
281281
equal(this, element[0], "context of event");
282282
deepEqual(ui, {}, "ui hash in event");
@@ -314,7 +314,7 @@ test("beforeClose", function() {
314314
ok( element.dialog("widget").is(":visible"), "beforeClose callback should prevent dialog from closing");
315315
element.remove();
316316

317-
element = $("<div></div>").dialog().bind("dialogbeforeclose", function(ev, ui) {
317+
element = $("<div></div>").dialog().on("dialogbeforeclose", function(ev, ui) {
318318
ok(true, ".dialog('close') triggers dialogbeforeclose event");
319319
equal(this, element[0], "context of event");
320320
deepEqual(ui, {}, "ui hash in event");

tests/unit/dialog/methods.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ asyncTest("#9000: Dialog leaves broken event handler after close/destroy in cert
8484
expect( 1 );
8585
$( "#dialog1" ).dialog({ modal:true }).dialog( "close" ).dialog( "destroy" );
8686
setTimeout(function() {
87-
$( "#favorite-animal" ).focus();
87+
$( "#favorite-animal" ).trigger( "focus" );
8888
ok( true, "close and destroy modal dialog before its really opened" );
8989
start();
9090
});
@@ -223,23 +223,23 @@ asyncTest( "#8958: dialog can be opened while opening", function() {
223223
// Support: IE8
224224
// For some reason the #favorite-color input doesn't get focus if we don't
225225
// focus the body first, causing the test to hang.
226-
$( "body" ).focus();
226+
$( "body" ).trigger( "focus" );
227227

228228
$( "#favorite-animal" )
229229
// We focus the input to start the test. Once it receives focus, the
230230
// dialog will open. Opening the dialog, will cause an element inside
231231
// the dialog to gain focus, thus blurring the input.
232-
.bind( "focus", function() {
232+
.on( "focus", function() {
233233
element.dialog( "open" );
234234
})
235235
// When the input blurs, the dialog is in the process of opening. We
236236
// try to open the dialog again, to make sure that dialogs properly
237237
// handle a call to the open() method during the process of the dialog
238238
// being opened.
239-
.bind( "blur", function() {
239+
.on( "blur", function() {
240240
element.dialog( "open" );
241241
})
242-
.focus();
242+
.trigger( "focus" );
243243
});
244244

245245
test("#5531: dialog width should be at least minWidth on creation", function () {

tests/unit/dialog/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ test("buttons - advanced", function( assert ) {
171171
assert.hasClasses( buttons, "additional-class" );
172172
deepEqual( buttons.button("option", "icons"), { primary: "ui-icon-cancel", secondary: null } );
173173
equal( buttons.button( "option", "text" ), false );
174-
buttons.click();
174+
buttons.trigger( "click" );
175175

176176
element.remove();
177177
});

tests/visual/compound/dialog_widgets.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
$( "#autocomplete" ).autocomplete({
3232
source: [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl" ]
3333
});
34-
$( "button" ).button().click(function() {
34+
$( "button" ).button().on( "click", function() {
3535
$( "#dialog2" ).dialog( "open" );
3636
});
3737
$( "#datepicker" ).datepicker();

tests/visual/dialog/animated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
modal: true
3232
});
3333

34-
$( "#opener" ).click(function() {
34+
$( "#opener" ).on( "click", function() {
3535
$( "#dialog" ).dialog( "open" );
3636
});
3737
});

tests/visual/dialog/complex-dialogs.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
width: 600
5858
});
5959

60-
$( "#open-dialog" ).click(function() {
60+
$( "#open-dialog" ).on( "click", function() {
6161
dialog.dialog( "open" );
6262
});
6363

64-
$( "#open-datepicker" ).click(function() {
64+
$( "#open-datepicker" ).on( "click", function() {
6565
datepickerDialog.dialog( "open" );
6666
});
6767

68-
$( "#open-autocomplete" ).click(function() {
68+
$( "#open-autocomplete" ).on( "click", function() {
6969
autocompleteDialog.dialog( "open" );
7070
});
7171

@@ -81,7 +81,7 @@
8181
]
8282
});
8383

84-
$( "#destroy-dialog" ).click(function() {
84+
$( "#destroy-dialog" ).on( "click", function() {
8585
dialog.dialog( "destroy" ).show();
8686
$( this ).remove();
8787
});

tests/visual/dialog/form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
modal: true
2424
});
2525

26-
$( "#open-form" ).click(function() {
26+
$( "#open-form" ).on( "click", function() {
2727
$( "#form-dialog" ).dialog( "open" );
2828
});
2929

30-
$( "#open-prompt" ).click(function() {
30+
$( "#open-prompt" ).on( "click", function() {
3131
$( "#prompt-dialog" ).dialog( "open" );
3232
});
3333
});

tests/visual/dialog/performance.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
});
2727
$( "<li>Create: " + ($.now() - start) + "ms</li>" ).appendTo( "#log" );
2828

29-
$( "#opener" ).click(function() {
29+
$( "#opener" ).on( "click", function() {
3030
start = $.now();
3131
$( "#dialog" ).dialog( "open" );
3232
$( "<li>Open: " + ($.now() - start) + "ms</li>" ).appendTo( "#log" );

0 commit comments

Comments
 (0)