Commit 8594decf authored by Michał Gołębiowski's avatar Michał Gołębiowski Committed by Richard Gibson

Ref #13554: Move redundant methods to event-alias.js. Close gh-1225.

(cherry picked from commits 8ca9f931 84a94aca 100d3c35)
parent 8f4bebea
......@@ -10,6 +10,23 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
};
});
jQuery.fn.hover = function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
};
jQuery.fn.extend({
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
}
});
......@@ -971,21 +971,6 @@ jQuery.fn.extend({
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
......
......@@ -1627,13 +1627,13 @@ module( "ajax", {
type: "POST"
});
jQuery( document ).bind( "ajaxStart ajaxStop", function() {
jQuery( document ).on( "ajaxStart ajaxStop", function() {
ok( false, "Global event triggered" );
});
jQuery("#qunit-fixture").append("<script src='data/evalScript.php'></script>");
jQuery( document ).unbind("ajaxStart ajaxStop");
jQuery( document ).off("ajaxStart ajaxStop");
});
asyncTest( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function() {
......@@ -1906,7 +1906,7 @@ module( "ajax", {
});
jQuery( document ).ajaxComplete(function( e, xml, s ) {
strictEqual( s.dataType, "html", "Verify the load() dataType was html" );
jQuery( document ).unbind("ajaxComplete");
jQuery( document ).off("ajaxComplete");
start();
});
jQuery("#first").load("data/test3.html");
......
......@@ -88,7 +88,7 @@ test("jQuery.data({})", 25, function() {
test("jQuery.data(window)", 25, function() {
// remove bound handlers from window object to stop potential false positives caused by fix for #5280 in
// transports/xhr.js
jQuery(window).unbind("unload");
jQuery(window).off("unload");
dataTests(window);
});
......@@ -599,7 +599,7 @@ test("Triggering the removeData should not throw exceptions. (#10080)", function
expect(1);
stop();
var frame = jQuery("#loadediframe");
jQuery(frame[0].contentWindow).bind("unload", function() {
jQuery(frame[0].contentWindow).on("unload", function() {
ok(true, "called unload");
start();
});
......
This diff is collapsed.
......@@ -172,8 +172,8 @@ var testWrap = function( val ) {
ok( true, "Event triggered." );
// Remove handlers on detached elements
result.unbind();
jQuery(this).unbind();
result.off();
jQuery(this).off();
});
j = jQuery("<span/>").wrap( result );
......@@ -643,9 +643,9 @@ test( "append the same fragment with events (Bug #6997, 5566)", function() {
if ( doExtra ) {
element = jQuery("div:first").on( "click", function() {
ok( true, "Event exists on original after being unbound on clone" );
jQuery( this ).unbind("click");
jQuery( this ).off("click");
});
clone = element.clone( true ).unbind("click");
clone = element.clone( true ).off("click");
clone[ 0 ].fireEvent("onclick");
element[ 0 ].fireEvent("onclick");
......@@ -2021,7 +2021,7 @@ test( "Cloned, detached HTML5 elems (#10667,10670)", function() {
}
// Bind an event
$section.bind( "click", function( event ) {
$section.on( "click", function( event ) {
ok( true, "clone fired event" );
});
......@@ -2030,7 +2030,7 @@ test( "Cloned, detached HTML5 elems (#10667,10670)", function() {
// Trigger an event from the first clone
$clone.trigger("click");
$clone.unbind("click");
$clone.off("click");
// Add a child node with text to the original
$section.append("<p>Hello</p>");
......@@ -2042,7 +2042,7 @@ test( "Cloned, detached HTML5 elems (#10667,10670)", function() {
// Trigger an event from the third clone
$clone.trigger("click");
$clone.unbind("click");
$clone.off("click");
// Add attributes to copy
$section.attr({
......@@ -2069,8 +2069,8 @@ test( "Cloned, detached HTML5 elems (#10667,10670)", function() {
$section.trigger("click");
// Unbind any remaining events
$section.unbind("click");
$clone.unbind("click");
$section.off("click");
$clone.off("click");
});
test( "Guard against exceptions when clearing safeChildNodes", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment