Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Scrollable index should force Number() type before setting index in seekTo() #125
It related to me using a.attr( "href" ) as the source for the index value in a seekTo call. Even though the value was numeric ( i.e. 5 ), being href, it was cast as String. This caused seekTo() to cast the new index value as a String in the scrollable object, essentially fubarring the function of move(), next(), and prev(). What should have been 5 + 1 = 6, would instead become "5" + 1 = "51".
Admittedly, I should have cast the href as a number BEFORE passing it to seekTo, which was my eventual workaround, but the library should also assume that it might get inappropriately cast variables and make sure the Types of internal properties don't get changed.
Anyway, I hope that was clear. I didn't poke around too much in the code, but I would suggest adding something like
yes. good idea. the index is now forced to be numeric. here is the patch: