From 32b1cb3a5cde49b444fe4de269631942e9254b57 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 22 Apr 2008 21:59:40 +0000 Subject: [PATCH] jquery.event: Patch for #2708 --- src/event.js | 3 +++ test/unit/event.js | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/event.js b/src/event.js index 4be458798..e08a085c8 100644 --- a/src/event.js +++ b/src/event.js @@ -293,6 +293,9 @@ jQuery.event = { originalEvent.cancelBubble = true; }; + // Fix timeStamp + event.timeStamp = event.timeStamp || +new Date; + // Fix target property, if necessary if ( !event.target ) event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either diff --git a/test/unit/event.js b/test/unit/event.js index 0ec0f5966..68c54cb19 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -165,7 +165,7 @@ test("unbind(event)", function() { ok( !jQuery.data(el[0], "events"), "Removed the events expando after all handlers are unbound." ); reset(); - var clickCounter = mouseoverCounter = 0; + var clickCounter = (mouseoverCounter = 0); var handler = function(event) { if (event.type == "click") clickCounter += 1; @@ -304,3 +304,11 @@ test("jQuery(function($) {})", function() { 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 -- 2.39.5