Ticket #2528785 (accepted defect)

Reporter


Josh Lizarraga
Opened: 04/14/10
Last modified: 03/11/12
Status: accepted
Type: defect

Owner


Luke Smith
Target Release:
Priority: P4 (low)
Summary: Slider fires first setValue() call twice if "max" is 200 or greater.
Description:

This was a difficult problem to isolate. Not sure what the heck is going on here. The first time you call setValue() or set('value', someVal) after rendering a slider with a "max" of >=200, it ends up
being called twice. Subscribing to the valueChange event reveals that the value for one of the calls is different than what you set.

See the simple test case below. If you change the "max" configuration parameter to 199 or lower, the bug goes away. If you set the "min" and "max" parameters to high numbers (say, 1000 and 100000,
respectively), the discrepancy between the two values picked up by valueChange is much greater.

Type: defect Observed in Version: 3.1.0
Component: Slider Severity: S3 (normal)
Assigned To: Luke Smith Target Release:
Location: Library Code Priority: P4 (low)
Tags: slider, setValue, max Relates To:
Browsers: Firefox 3.x - PC,Safari 4.x - PC,IE 6.x
URL:
Test Information:


<!doctype html>
<html>
<head>
<title>Slider Test</title>
</head>
<body class="yui3-skin-sam">

<span id="slider-test"></span>

<script src="http://yui.yahooapis.com/3.1.0/build/yui/yui-min.js"></script>

<script type="text/javascript">
YUI().use('slider', function(Y){

var oSlider = new Y.Slider({
max: 200
});

oSlider.render('#slider-test');

oSlider.on('valueChange', function(e){

console.log('valueChange: ' + e.newVal);

});

oSlider.set('value', 100);

});
</script>

</body>
</html>

Change History

Luke Smith

YUI Contributor

Posted: 04/15/10
  • milestone changed to 3.2.0
  • priority changed to P3 (normal)
  • status changed from new to accepted

Luke Smith

YUI Contributor

Posted: 06/30/10
  • milestone changed from 3.2.0 to 3.3.0

M K

YUI Contributor

Posted: 08/30/10
  • browser changed from Firefox 3.x - PC,Safari 4.x - PC,IE 6.x,Opera 9.x - PC to Firefox 3.x - PC,Safari 4.x - PC,IE 6.x

Hi,
I've encountered that in my Ticks slider extension.

This is due to the calculations of the thumb position.
I've for now did a workaround to avoid it using bind/unbind technique:

@ this._unBindValueLogic();
var tick = this._nearestTick(e.newVal);
this._setPosition(tick.newVal);
this.fire( 'tickChange', tick );
this._bindValueLogic(); @

Luke Smith

YUI Contributor

Posted: 10/14/10
  • milestone changed from 3.3.0 to 3.NEXT

Jenny Donnelly

YUI Developer

Posted: 11/30/11

Resolving as "expired" due to lack of activity. Please feel free to reopen if this issue is still important to you.

Jenny Donnelly

YUI Developer

Posted: 12/5/11
  • resolution changed to expired
  • status changed from accepted to closed

Luke Smith

YUI Contributor

Posted: 03/11/12
  • location changed to Library Code
  • milestone changed from 3.NEXT
  • priority changed from P3 (normal) to P4 (low)
  • resolution changed from expired
  • status changed from closed to reopened

Lack of activity != fixed. This is still a bug, though there may be limited resources to deal with it.

Luke Smith

YUI Contributor

Posted: 03/11/12
  • status changed from reopened to accepted