For ease of maintenance, we should share the code, e.g. move into common place.
Also, the function may do divide by zero in following line:
var itemHeight = Math.floor(sl.offsetHeight / sl.size);
Test case authors must write non-zero "size" attribute for the "select" element.
I think it is better to throw exception if sl.size is zero.