Side navigation
#1142 closed bug (wontfix)
Opened April 25, 2007 07:23AM UTC
Closed April 25, 2007 11:27PM UTC
Last modified June 21, 2007 05:03AM UTC
handle() should not iterate inherited members
| Reported by: | flamefork | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.1.3 | 
| Component: | event | Version: | 1.1.2 | 
| Keywords: | Cc: | ||
| Blocked by: | Blocking: | 
Description
There is a bug when object.prototype has custom functions.
Actually it was detected when jquery was used with json.js (it has Object.prototype.toJSONString() function)
http://dev.jquery.com/browser/trunk/jquery/src/event/event.js#L164
164	        for ( var j in c ) {
165	            // Pass in a reference to the handler function itself
166	            // So that we can later remove it
167	            args[0].handler = c[j];
168	            args[0].data = c[j].data;
169	
170	            if ( c[j].apply( this, args ) === false ) {
171	                event.preventDefault();
172	                event.stopPropagation();
173	                returnValue = false;
174	            }
175	        }
should be
for ( var j in c ) {
   if (c.hasOwnProperty(j)) {
      ...
   }
}
Attachments (0)
Change History (2)
Changed April 25, 2007 08:08AM UTC by comment:1
Changed April 25, 2007 11:27PM UTC by comment:2
| resolution: | → wontfix | 
|---|---|
| status: | new → closed | 
Changes to the Object prototype are not supported and should be avoided. Please search the list, fixes for json.js have been provided. http://groups.google.com/group/jquery-en
The same thing exists in $.ajax() params.