Skip to main content

Search and Top Navigation

#5621 closed bug (duplicate)

Opened May 17, 2010 04:46PM UTC

Closed May 17, 2010 05:19PM UTC

Last modified May 20, 2010 11:14AM UTC

function _setOption uses self instead of this

Reported by: karachi Owned by:
Priority: major Milestone: 1.8.2
Component: ui.sortable Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:
Description

Steps to reproduce:

1. Create sortable objects: $('#sort').sortable();

2. Set option via method 'option': $('#sort').sortable('option', 'axis', 'x')

3. Error occures: this.options is undefined

This occures because function $.Widget.prototype._setOption() is called in context of ''self'' which points to window. ''This'' should be used instead.

Here is the patch

--- jquery.ui.sortable.js	2010-04-30 11:50:24.000000000 +0300
+++ jquery.ui.sortable.fixed.js	2010-05-17 19:38:26.000000000 +0300
@@ -81,7 +81,7 @@
 				[ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
 		} else {
 			// Don't call widget base _setOption for disable as it adds ui-state-disabled class
-			$.Widget.prototype._setOption.apply(self, arguments);
+			$.Widget.prototype._setOption.apply(this, arguments);
 		}
 	},

Attachments (1)
  • setOption.patch (0.4 KB) - added by karachi May 17, 2010 04:47PM UTC.

    Patch that fixes ticket

Change History (2)

Changed May 17, 2010 05:19PM UTC by rdworth comment:1

milestone: TBD1.9
resolution: → duplicate
status: newclosed

Duplicate of #5581

Changed May 20, 2010 11:14AM UTC by rdworth comment:2

milestone: 1.91.8.2