Skip to main content

Search and Top Navigation

#8542 closed bug (wontfix)

Opened August 31, 2012 11:08AM UTC

Closed August 31, 2012 11:48AM UTC

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

Attachments (0)
Change History (2)

Changed August 31, 2012 11:26AM UTC by rudygotya comment:1

_comment0: forget about the "fix" - sry.1346412446890348

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

Changed August 31, 2012 11:48AM UTC by scottgonzalez comment:2

resolution: → wontfix
status: newclosed

jQuery doesn't support modifying Object.prototype.