From d654914fd02412f8d2537279bb8a4db9ecc7095e Mon Sep 17 00:00:00 2001 From: Andrew Plummer Date: Thu, 31 Jan 2013 12:01:34 -0600 Subject: event: Stricter type checking in trigger - Fixes #13360 - Closes gh-1153 Squashed commit of the following: commit 5935a362c75ecef04d5ec9775cbcaf2165921e8d Author: Andrew Plummer Date: Fri Feb 1 02:40:42 2013 +0900 Using "hasOwnProperty" to check for direct properties "type" and "namespace" on events before triggering. (cherry picked from commit f005af54e4983658e3ae504111885921c4dca383) --- test/unit/event.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/unit/event.js b/test/unit/event.js index c14740104..295a4b8d4 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2663,3 +2663,17 @@ test( "Check order of focusin/focusout events", 2, function() { input.off(); }); +test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() { + expect( 1 ); + var errored = false; + + String.prototype.namespace = function() {}; + + try { + jQuery("

").trigger("foo.bar"); + } catch( e ) { + errored = true; + } + equal( errored, false, "trigger() did not throw exception" ); + delete String.prototype.namespace; +}); -- cgit v1.2.3