This problem could be solved by separating the function into two other functions and name them in a way that what they do is clear, for example,grid.highlight(element)andgrid.scrollTo(element). This example nicely illustrates why I think this principle has a place even though it may seem ...