Commit 32b1cb3a authored by Jörn Zaefferer's avatar Jörn Zaefferer

jquery.event: Patch for #2708

parent 6d28ebff
...@@ -293,6 +293,9 @@ jQuery.event = { ...@@ -293,6 +293,9 @@ jQuery.event = {
originalEvent.cancelBubble = true; originalEvent.cancelBubble = true;
}; };
// Fix timeStamp
event.timeStamp = event.timeStamp || +new Date;
// Fix target property, if necessary // Fix target property, if necessary
if ( !event.target ) if ( !event.target )
event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
......
...@@ -165,7 +165,7 @@ test("unbind(event)", function() { ...@@ -165,7 +165,7 @@ test("unbind(event)", function() {
ok( !jQuery.data(el[0], "events"), "Removed the events expando after all handlers are unbound." ); ok( !jQuery.data(el[0], "events"), "Removed the events expando after all handlers are unbound." );
reset(); reset();
var clickCounter = mouseoverCounter = 0; var clickCounter = (mouseoverCounter = 0);
var handler = function(event) { var handler = function(event) {
if (event.type == "click") if (event.type == "click")
clickCounter += 1; clickCounter += 1;
...@@ -304,3 +304,11 @@ test("jQuery(function($) {})", function() { ...@@ -304,3 +304,11 @@ test("jQuery(function($) {})", function() {
start(); start();
}); });
}); });
test("event properties", function() {
stop();
$("#simon1").click(function(event) {
ok( event.timeStamp, "assert event.timeStamp is present" );
start();
}).click();
});
\ No newline at end of file
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