Opened 11 years ago

Closed 11 years ago

#8542 closed bug (wontfix)

bug: Widget _on shoud ignore extended Object.prototype

Reported by: rudygotya Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.widget Version: git (not yet released)
Keywords: Cc:
Blocked by: Blocking:

Description

Hi,

when Object.prototype is extended, _on() breaks.

jsfiddle: http://jsfiddle.net/rudygotya/Y9veP/

fix:

diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 924d10b..80286ed 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -359,6 +359,11 @@ $.Widget.prototype = {
 
                var instance = this;
                $.each( handlers, function( event, handler ) {
+
+                       if( ! handler.hasOwnProperty( event ) ) {
+                               return;
+                       }
+
                        function handlerProxy() {
                                // allow widgets to customize the disabled handling
                                // - disabled as an array instead of boolean

best regards

Sebastian

Change History (2)

comment:1 Changed 11 years ago by rudygotya

forget about the "fix" - sry. It has to be handlers.hasOwnProperty of course.

Last edited 11 years ago by rudygotya (previous) (diff)

comment:2 Changed 11 years ago by Scott González

Resolution: wontfix
Status: newclosed

jQuery doesn't support modifying Object.prototype.

Note: See TracTickets for help on using tickets.