This commit is contained in:
parent
1bd4325cb9
commit
851846aabe
|
@ -116,7 +116,8 @@ jQuery.event = {
|
||||||
// Namespaced event handlers
|
// Namespaced event handlers
|
||||||
var namespaces = type.split(".");
|
var namespaces = type.split(".");
|
||||||
type = namespaces.shift();
|
type = namespaces.shift();
|
||||||
var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
|
var all = !namespaces.length,
|
||||||
|
namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
|
||||||
|
|
||||||
if ( events[type] ) {
|
if ( events[type] ) {
|
||||||
// remove the given handler for the given type
|
// remove the given handler for the given type
|
||||||
|
@ -127,7 +128,7 @@ jQuery.event = {
|
||||||
else
|
else
|
||||||
for ( var handle in events[type] )
|
for ( var handle in events[type] )
|
||||||
// Handle the removal of namespaced events
|
// Handle the removal of namespaced events
|
||||||
if ( namespace.test(events[type][handle].type) )
|
if ( all || namespace.test(events[type][handle].type) )
|
||||||
delete events[type][handle];
|
delete events[type][handle];
|
||||||
|
|
||||||
if ( jQuery.event.specialAll[type] )
|
if ( jQuery.event.specialAll[type] )
|
||||||
|
|
|
@ -194,6 +194,11 @@ test("unbind(type)", function() {
|
||||||
$elem.bind('error error2',error)
|
$elem.bind('error error2',error)
|
||||||
.unbind('error error2')
|
.unbind('error error2')
|
||||||
.trigger('error').triggerHandler('error2');
|
.trigger('error').triggerHandler('error2');
|
||||||
|
|
||||||
|
message = "unbind without a type or handler";
|
||||||
|
$elem.bind("error error2.test",error)
|
||||||
|
.unbind()
|
||||||
|
.trigger("error").triggerHandler("error2");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("unbind(eventObject)", function() {
|
test("unbind(eventObject)", function() {
|
||||||
|
|
Loading…
Reference in a new issue