Ticket #5621 (closed bug: duplicate)

Opened 5 years ago

Last modified 5 years ago

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:
Blocking: Blocked by:

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

setOption.patch Download (446 bytes) - added by karachi 5 years ago.
Patch that fixes ticket

Change History

Changed 5 years ago by karachi

Patch that fixes ticket

comment:1 Changed 5 years ago by rdworth

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone changed from TBD to 1.9

Duplicate of #5581

comment:2 Changed 5 years ago by rdworth

  • Milestone changed from 1.9 to 1.8.2
Note: See TracTickets for help on using tickets.