   before != after
 
 # Find the element we should and can scroll.
-findScrollableElement = (element, direction, amount, factor = 1) ->
+findScrollableElement = (element = document.body, direction, amount, factor = 1) ->
   axisName = scrollProperties[direction].axisName
   while element != document.body and
     not (isScrollPossible(element, direction, amount, factor) and isScrollAllowed(element, direction))


# Test whether element should be scrolled.
isScrollAllowed = (element, direction) ->
  # Elements with `overflow: hidden` should not be scrolled.
  window.getComputedStyle(element).getPropertyValue("overflow-#{direction}") != "hidden"

# Test whether element actually scrolls in the direction required when asked to do so.
# Due to chrome bug 110149, scrollHeight and clientHeight cannot be used to reliably determine whether an

#
# activatedElement is different from document.activeElement -- the latter seems to be reserved mostly for
# input elements. This mechanism allows us to decide whether to scroll a div or to scroll the whole document.
#
activatedElement = null
settings = null

scrollProperties =
  x: {
