Bug Tracker

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#1168 closed bug (fixed)

SVN: "Error: this.$events has no properties" when using e.g. click()

Reported by: blueyed Owned by:
Priority: major Milestone: 1.1.3
Component: event Version:
Keywords: Cc:
Blocked by: Blocking:

Description

Something seems to have broken recently in SVN (after 1.1.2).

I'm getting:

Error: this.$events has no properties
Source File: file:///XXX/jquery.js
Line: 2904

This line is:

var c = this.$events[event.type], args = [].slice.call( arguments, 1 );

I've fixed it like below, but probably the real problem is that this.$events is not initialised before.

--- /jquery/src/event/event.js	(Revision 1883)
+++ /jquery/src/event/event.js	(Arbeitskopie)
@@ -157,6 +157,10 @@
 		// Empty object is for triggered events with no data
 		event = jQuery.event.fix( event || window.event || {} ); 
 
+		// return if there are no events registered from us. This happens when triggering input.click() since after jQuery 1.1.2 (nightly build from 2007-05-05)
+		if(!this.$events)
+			return val;
+
 		var c = this.$events[event.type], args = [].slice.call( arguments, 1 );
 		args.unshift( event );

This happens with SVN r1883 and the following test page:

<html>

<head>
<script type="text/javascript" src="jquery.js"></script>
</head>

<body>
<form onsubmit="alert('submitted.'); return false;">
    <input type="submit" id="submit" value="submit" />
</form>

<script type="text/javascript">
$("#submit").click();
</script>

</body>
</html>

Change History (1)

comment:1 Changed 14 years ago by brandon

Resolution: fixed
Status: newclosed

Fixed in Rev [1885].

Note: See TracTickets for help on using tickets.