I had a bug in my code that caused the duration option passed to the constructor to be negative.
My fault, of course. But the consequence was that animateSlide() went into an infinite loop and crashed the tab / browser! (The details don't really matter, but when duration is negative, MAX_VALUES is negative, which causes the subsample check to fail and the loop boundary checks to have the wrong sign.)
Given such a severe and hard-to-debug consequence, I think it would be a good idea to validate the value of duration in the constructor. (And I note that you're already validating format.)
I had a bug in my code that caused the
duration
option passed to the constructor to be negative.My fault, of course. But the consequence was that
animateSlide()
went into an infinite loop and crashed the tab / browser! (The details don't really matter, but whenduration
is negative,MAX_VALUES
is negative, which causes the subsample check to fail and the loop boundary checks to have the wrong sign.)Given such a severe and hard-to-debug consequence, I think it would be a good idea to validate the value of
duration
in the constructor. (And I note that you're already validatingformat
.)