     else if linksMatched.length == 1
       @activateLink linksMatched[0], userMightOverType
     else
-      @hideMarker marker for marker in @hintMarkers
-      @showMarker matched, @markerMatcher.hintKeystrokeQueue.length for matched in linksMatched
+      for marker in @hintMarkers
+        @hideMarker marker
+      for matched in linksMatched
+        @showMarker matched, @markerMatcher.hintKeystrokeQueue.length
 
     @setIndicator()
 
+  markerOverlapsStack: (marker, stack) ->
+    for otherMarker in stack
+      if Rect.intersects marker.markerRect, otherMarker.markerRect
+        return true
+    false
+
   # Rotate the hints' z-index values so that hidden hints become visible.
-  rotateHints: do ->
-    markerOverlapsStack = (marker, stack) ->
-      for otherMarker in stack
-        return true if Rect.intersects marker.markerRect, otherMarker.markerRect
-      false
-
-    ->
-      # Get local, visible hint markers.
-      localHintMarkers = @hintMarkers.filter (marker) ->
-        marker.isLocalMarker and marker.style.display != "none"
-
-      # Fill in the markers' rects, if necessary.
-      marker.markerRect ?= marker.getClientRects()[0] for marker in localHintMarkers
-
-      # Calculate the overlapping groups of hints.  We call each group a "stack".  This is O(n^2).
-      stacks = []
-      for marker in localHintMarkers
-        stackForThisMarker = null
-        stacks =
-          for stack in stacks
-            markerOverlapsThisStack = markerOverlapsStack marker, stack
-            if markerOverlapsThisStack and not stackForThisMarker?
-              # We've found an existing stack for this marker.
-              stack.push marker
-              stackForThisMarker = stack
-            else if markerOverlapsThisStack and stackForThisMarker?
-              # This marker overlaps a second (or subsequent) stack; merge that stack into stackForThisMarker
-              # and discard it.
-              stackForThisMarker.push stack...
-              continue # Discard this stack.
-            else
-              stack # Keep this stack.
-        stacks.push [marker] unless stackForThisMarker?
-
-      # Rotate the z-indexes within each stack.
+  rotateHints: ->
+    # Get local, visible hint markers.
+    localHintMarkers = @hintMarkers.filter (marker) ->
+      marker.isLocalMarker and marker.style.display != "none"
+
+    # Fill in the markers' rects, if necessary.
+    marker.markerRect ?= marker.getClientRects()[0] for marker in localHintMarkers
+
+    # Calculate the overlapping groups of hints.  We call each group a "stack".  This is O(n^2).
+    stacks = []
+    for marker in localHintMarkers
+      stackForThisMarker = null
+      results = []
       for stack in stacks
-        if 1 < stack.length
-          zIndexes = (marker.style.zIndex for marker in stack)
-          zIndexes.push zIndexes[0]
-          marker.style.zIndex = zIndexes[index + 1] for marker, index in stack
-
-      null # Prevent Coffeescript from building an unnecessary array.
+        markerOverlapsThisStack = @markerOverlapsStack marker, stack
+        if markerOverlapsThisStack and not stackForThisMarker?
+          # We've found an existing stack for this marker.
+          stack.push marker
+          stackForThisMarker = stack
+          results.push(stack)
+        else if markerOverlapsThisStack and stackForThisMarker?
+          # This marker overlaps a second (or subsequent) stack; merge that stack into stackForThisMarker
+          # and discard it.
+          stackForThisMarker.push stack...
+          continue # Discard this stack.
+        else
+          stack # Keep this stack.
+          results.push(stack)
+      stacks = results
+
+      unless stackForThisMarker?
+        stacks.push [marker]
+
+    # Rotate the z-indexes within each stack.
+    for stack in stacks
+      if stack.length > 1
+        zIndexes = stack.map((marker) => marker.style.zIndex)
+        zIndexes.push zIndexes[0]
+        for marker, index in stack
+          marker.style.zIndex = zIndexes[index + 1]
+
+    null # Prevent Coffeescript from building an unnecessary array.
 
   # When only one hint remains, activate it in the appropriate way.  The current frame may or may not contain
   # the matched link, and may or may not have the focus.  The resulting four cases are accounted for here by

      when "textarea"
        isClickable ||= not element.disabled and not element.readOnly
      when "input"
        isClickable ||= not (element.getAttribute("type")?.toLowerCase() == "hidden" or
                             element.disabled or
                             (element.readOnly and DomUtils.isSelectable element))
      when "button", "select"

  #
  getLocalHints: (requireHref) ->
    # We need documentElement to be ready in order to find links.
    unless document.documentElement
      return []
    # Find all elements, recursing into shadow DOM if present.
    getAllElements = (root, elements = []) ->
      for element in root.querySelectorAll "*"
