]> source.dussan.org Git - jquery.git/commitdiff
Made sure that the correct event.taget is being used in event bubbling.
authorJohn Resig <jeresig@gmail.com>
Mon, 22 Dec 2008 02:02:05 +0000 (02:02 +0000)
committerJohn Resig <jeresig@gmail.com>
Mon, 22 Dec 2008 02:02:05 +0000 (02:02 +0000)
test/unit/event.js

index eb9af7a340b349404a9826c923bfd08842a2b208..4b96a4f340faae337ee9232647a8365232b7f754 100644 (file)
@@ -203,10 +203,10 @@ test("trigger() bubbling", function() {
 
        var doc = 0, html = 0, body = 0, main = 0, ap = 0;
 
-       jQuery(document).bind("click", function(){ doc++; });
-       jQuery("html").bind("click", function(){ html++; });
-       jQuery("body").bind("click", function(){ body++; });
-       jQuery("#main").bind("click", function(){ main++; });
+       jQuery(document).bind("click", function(e){ if ( e.target !== document) { doc++; } });
+       jQuery("html").bind("click", function(e){ html++; });
+       jQuery("body").bind("click", function(e){ body++; });
+       jQuery("#main").bind("click", function(e){ main++; });
        jQuery("#ap").bind("click", function(){ ap++; return false; });
 
        jQuery("html").trigger("click");