github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 670
    • 123
  • Source
  • Commits
  • Network (123)
  • Graphs
  • Tree: 3291d39

click here to add a description

click here to add a homepage

  • Switch Branches (7)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
  • Switch Tags (18)
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

sortable: don't call the base widget _setOption for disabled to avoid the 
ui-state-disabled class being added. Fixes #5501 - sortable: disabled should not 
have the ui-state-disabled class
rdworth (author)
Fri Apr 09 11:43:44 -0700 2010
commit  3291d3951ab177cde692
tree    368b5d5542d263e2d483
parent  ffc29bba052e4bc8b84e
M tests/unit/sortable/sortable_methods.js 3 •••
M ui/jquery.ui.sortable.js 12 •••••
Txt tests/unit/sortable/sortable_methods.js
  • View file @ 3291d39
... ...
@@ -84,7 +84,7 @@ test("enable", function() {
84 84
 });
85 85
 
86 86
 test("disable", function() {
87  
-  expect(6);
  87
+  expect(7);
88 88
   el = $("#sortable").sortable({ disabled: false });
89 89
   sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
90 90
 
... ...
@@ -97,6 +97,7 @@ test("disable", function() {
97 97
   sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
98 98
   el.sortable("option", "disabled", true);
99 99
   equals(el.sortable("option", "disabled"), true, "disabled option setter");
  100
+  ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction");
100 101
   sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)');
101 102
   
102 103
   var expected = $('<div></div>').sortable(),
Txt ui/jquery.ui.sortable.js
  • View file @ 3291d39
... ...
@@ -73,6 +73,18 @@ $.widget("ui.sortable", $.ui.mouse, {
73 73
     return this;
74 74
   },
75 75
 
  76
+  _setOption: function(key, value){
  77
+    if ( key === "disabled" ) {
  78
+      this.options[ key ] = value;
  79
+  
  80
+      this.widget()
  81
+        [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
  82
+    } else {
  83
+      // Don't call widget base _setOption for disable as it adds ui-state-disabled class
  84
+      $.Widget.prototype._setOption.apply(self, arguments);
  85
+    }
  86
+  },
  87
+
76 88
   _mouseCapture: function(event, overrideHandle) {
77 89
 
78 90
     if (this.reverting) {

2 notes on commit 3291d39

jzaefferer added a note to 3291d39 repo collab

Wed May 05 02:31:51 -0700 2010

.apply(self should be .apply(this, as mentioned here: http://forum.jquery.com/topic/sortable-21-4-2010

ornicar added a note to 3291d39

Wed May 05 03:18:54 -0700 2010

I fixed it on my fork, and sent a pull request.

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server