Fix some whitespace issues. Improve and correct an events test.
This commit is contained in:
parent
3f036281dd
commit
4490f4285c
|
@ -159,7 +159,7 @@ jQuery.fn.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( elem.parentNode ) {
|
if ( elem.parentNode ) {
|
||||||
elem.parentNode.removeChild( elem );
|
elem.parentNode.removeChild( elem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,8 +353,8 @@ function cloneCopyEvent( src, dest ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var internalKey = jQuery.expando,
|
var internalKey = jQuery.expando,
|
||||||
oldData = jQuery.data( src ),
|
oldData = jQuery.data( src ),
|
||||||
curData = jQuery.data( dest, oldData );
|
curData = jQuery.data( dest, oldData );
|
||||||
|
|
||||||
// Switch to use the internal data object, if it exists, for the next
|
// Switch to use the internal data object, if it exists, for the next
|
||||||
// stage of data copying
|
// stage of data copying
|
||||||
|
@ -537,7 +537,7 @@ jQuery.extend({
|
||||||
}
|
}
|
||||||
// Return the cloned set
|
// Return the cloned set
|
||||||
return clone;
|
return clone;
|
||||||
},
|
},
|
||||||
clean: function( elems, context, fragment, scripts ) {
|
clean: function( elems, context, fragment, scripts ) {
|
||||||
context = context || document;
|
context = context || document;
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,16 @@ module("event", { teardown: moduleTeardown });
|
||||||
|
|
||||||
test("null or undefined handler", function() {
|
test("null or undefined handler", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
// Supports Fixes bug #7229
|
// Supports Fixes bug #7229
|
||||||
try {
|
try {
|
||||||
|
jQuery("#firstp").click(null);
|
||||||
|
ok(true, "Passing a null handler will not throw an exception");
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
jQuery("#firstp").click(null);
|
try {
|
||||||
|
jQuery("#firstp").click(undefined);
|
||||||
ok(true, "Passing a null handler will not throw an exception");
|
ok(true, "Passing an undefined handler will not throw an exception");
|
||||||
|
} catch (e) {}
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
jQuery("#firstp").click(undefined);
|
|
||||||
|
|
||||||
ok(true, "Passing an undefined handler will not throw an exception");
|
|
||||||
|
|
||||||
} catch (e) {}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("bind(), with data", function() {
|
test("bind(), with data", function() {
|
||||||
|
@ -370,35 +364,37 @@ test("bind(), trigger change on select", function() {
|
||||||
test("bind(), namespaced events, cloned events", function() {
|
test("bind(), namespaced events, cloned events", function() {
|
||||||
expect(6);
|
expect(6);
|
||||||
|
|
||||||
jQuery("#firstp").bind("custom.test",function(e){
|
var firstp = jQuery( "#firstp" );
|
||||||
ok(true, "Custom event triggered");
|
|
||||||
|
firstp.bind("custom.test",function(e){
|
||||||
|
ok(false, "Custom event triggered");
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery("#firstp").bind("click",function(e){
|
firstp.bind("click",function(e){
|
||||||
ok(true, "Normal click triggered");
|
ok(true, "Normal click triggered");
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery("#firstp").bind("click.test",function(e){
|
firstp.bind("click.test",function(e){
|
||||||
ok(true, "Namespaced click triggered");
|
ok( true, "Namespaced click triggered" );
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trigger both bound fn (2)
|
// Trigger both bound fn (2)
|
||||||
jQuery("#firstp").trigger("click");
|
firstp.trigger("click");
|
||||||
|
|
||||||
// Trigger one bound fn (1)
|
// Trigger one bound fn (1)
|
||||||
jQuery("#firstp").trigger("click.test");
|
firstp.trigger("click.test");
|
||||||
|
|
||||||
// Remove only the one fn
|
// Remove only the one fn
|
||||||
jQuery("#firstp").unbind("click.test");
|
firstp.unbind("click.test");
|
||||||
|
|
||||||
// Trigger the remaining fn (1)
|
// Trigger the remaining fn (1)
|
||||||
jQuery("#firstp").trigger("click");
|
firstp.trigger("click");
|
||||||
|
|
||||||
// Remove the remaining fn
|
// Remove the remaining namespaced fn
|
||||||
jQuery("#firstp").unbind(".test");
|
firstp.unbind(".test");
|
||||||
|
|
||||||
// Trigger the remaining fn (0)
|
// Try triggering the custom event (0)
|
||||||
jQuery("#firstp").trigger("custom");
|
firstp.trigger("custom");
|
||||||
|
|
||||||
// using contents will get comments regular, text, and comment nodes
|
// using contents will get comments regular, text, and comment nodes
|
||||||
jQuery("#nonnodes").contents().bind("tester", function () {
|
jQuery("#nonnodes").contents().bind("tester", function () {
|
||||||
|
@ -471,7 +467,7 @@ test("bind(), multi-namespaced events", function() {
|
||||||
test("bind(), with same function", function() {
|
test("bind(), with same function", function() {
|
||||||
expect(2)
|
expect(2)
|
||||||
|
|
||||||
var count = 0 , func = function(){
|
var count = 0, func = function(){
|
||||||
count++;
|
count++;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -587,7 +583,7 @@ test("bind()/trigger()/unbind() on plain object", function() {
|
||||||
jQuery(obj).unbind("test");
|
jQuery(obj).unbind("test");
|
||||||
|
|
||||||
equals( obj && obj[ jQuery.expando ] &&
|
equals( obj && obj[ jQuery.expando ] &&
|
||||||
obj[ jQuery.expando ][ jQuery.expando ] &&
|
obj[ jQuery.expando ][ jQuery.expando ] &&
|
||||||
obj[ jQuery.expando ][ jQuery.expando ].events, undefined, "Make sure events object is removed" );
|
obj[ jQuery.expando ][ jQuery.expando ].events, undefined, "Make sure events object is removed" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue