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

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 248
    • 27
  • Source
  • Commits
  • Network (27)
  • Graphs
  • Tree: 0604e11

click here to add a description

click here to add a homepage

  • Switch Branches (4)
    • bind
    • master
    • panel
    • tooltip
  • Switch Tags (15)
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Slider: fixed change event to be triggered by keyup and value and values 
option setters. Fixes #5367 - slider change event not triggered by 
keypress
rdworth (author)
Wed Mar 17 10:39:29 -0700 2010
commit  0604e110524c77a4430666c9719942772b8caa86
tree    ec7e19cb566f7e6b8dc3538167d5ae6bafbaeb45
parent  e84a318e4670bed0d8690b0a7625df31d39aaf92
M tests/unit/slider/slider_events.js 4 ••••
M ui/jquery.ui.slider.js 12 ••••
Txt tests/unit/slider/slider_events.js
  • View file @ 0604e11
... ...
@@ -20,7 +20,7 @@ test( "slide", function() {
20 20
 // value (even if same as previous value), via mouse(mouseup) or keyboard(keyup)
21 21
 // or value method/option"
22 22
 test( "change", function() {
23  
-  expect(7);
  23
+  expect(8);
24 24
   
25 25
   var handle;
26 26
   // Test mouseup at end of handle slide (mouse)
... ...
@@ -48,7 +48,7 @@ test( "change", function() {
48 48
   el.find( ".ui-slider-handle" ).eq( 0 )
49 49
     .simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } )
50 50
     .simulate( "keypress", { keyCode: $.ui.keyCode.LEFT } )
51  
-    .simulate( "keyup", { charCode: $.ui.keyCode.LEFT } );
  51
+    .simulate( "keyup", { keyCode: $.ui.keyCode.LEFT } );
52 52
 
53 53
   reset();
54 54
   // Test value method
Txt ui/jquery.ui.slider.js
  • View file @ 0604e11
... ...
@@ -193,9 +193,9 @@ $.widget("ui.slider", $.ui.mouse, {
193 193
       var index = $(this).data("index.ui-slider-handle");
194 194
 
195 195
       if (self._keySliding) {
  196
+        self._keySliding = false;
196 197
         self._stop(event, index);
197 198
         self._change(event, index);
198  
-        self._keySliding = false;
199 199
         $(this).removeClass("ui-state-active");
200 200
       }
201 201
 
... ...
@@ -479,6 +479,12 @@ $.widget("ui.slider", $.ui.mouse, {
479 479
   },
480 480
 
481 481
   _setOption: function(key, value) {
  482
+    
  483
+    var i,
  484
+      valsLength = 0;
  485
+    if ( jQuery.isArray(this.options.values) ) {
  486
+      valsLength = this.options.values.length;
  487
+    };
482 488
 
483 489
     $.Widget.prototype._setOption.apply(this, arguments);
484 490
 
... ...
@@ -505,11 +511,15 @@ $.widget("ui.slider", $.ui.mouse, {
505 511
       case 'value':
506 512
         this._animateOff = true;
507 513
         this._refreshValue();
  514
+        this._change(null, 0);
508 515
         this._animateOff = false;
509 516
         break;
510 517
       case 'values':
511 518
         this._animateOff = true;
512 519
         this._refreshValue();
  520
+        for (i = 0; i < valsLength; i++) {
  521
+          this._change(null, i);
  522
+        }
513 523
         this._animateOff = false;
514 524
         break;
515 525
     }

0 notes on commit 0604e11

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