paper-slider icon indicating copy to clipboard operation
paper-slider copied to clipboard

Slider crashes when max and min set by databinding and min is greater than 100

Open akc42 opened this issue 8 years ago • 0 comments

Description

paper-slider crashes an attempt to create a new array with a negative number of entries.

This is because I am setting min and max (and step) via databinding from properties that have to be calculated and the order that the calculations happen, and therefore max and min get set cannot be guaranteed. I set min to 540, and max is still left at its default value of 100 (It should get set to 1020 very shortly afterwards)

_updateMarkers gets called because its an observer on (amongst other things) max and min. Because min is greater than max, the number of steps gets calculated as a negative number. THis negative number is used to create a new Array() and this throws the exception

Expected outcome

The slider doesn't fail

Actual outcome

There is an uncaught RangeError exception .

Live Demo

Steps to reproduce

Browsers Affected

  • [ ] Chrome
  • [ ] Firefox
  • [ ] Safari 9
  • [ ] Safari 8
  • [ ] Safari 7
  • [ ] Edge
  • [ ] IE 11
  • [ ] IE 10

akc42 avatar Nov 25 '16 17:11 akc42