Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#5621 closed bug (duplicate)

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 (446 bytes) - added by karachi 13 years ago.
Patch that fixes ticket

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by karachi

Attachment: setOption.patch added

Patch that fixes ticket

comment:1 Changed 13 years ago by rdworth

Milestone: TBD1.9
Resolution: duplicate
Status: newclosed

Duplicate of #5581

comment:2 Changed 13 years ago by rdworth

Milestone: 1.91.8.2
Note: See TracTickets for help on using tickets.