     @setLocationRange([startLocation, endLocation])
 
   getClientRectAtLocationRange: (locationRange) ->
-    if range = @createDOMRangeFromLocationRange(locationRange)
-      rects = [range.getClientRects()...]
-      rects[-1..][0]
+    if domRange = @createDOMRangeFromLocationRange(locationRange)
+      getClientRectForDOMRange(domRange)
 
   locationIsCursorTarget: (location) ->
     [node, offset] = @findNodeAndOffsetFromLocation(location)

      data: trixMutable: true
      trixSerialize: false

  getDOMSelection = ->
    selection = window.getSelection()
    selection if selection.rangeCount > 0

    element = findNodeFromContainerAndOffset(domRange["#{side}Container"], domRange["#{side}Offset"])

    if tagName(element) is "br"
      if rect = getClientRectForElement(element) ? getClientRectForDOMRange(domRange, side)
        x: rect.left, y: rect.bottom
    else
      element = makeMeasurementElement()
      domRange.collapse(false) if side is "end"
