       else
         clientRect = @cropRectToVisible clientRect
 
-        if (!clientRect || clientRect.width < 3 || clientRect.height < 3)
-          continue
+        continue unless clientRect
 
         # eliminate invisible elements (see test_harnesses/visibility_test.html)
         computedStyle = window.getComputedStyle(element, null)


    null

  cropRectToVisible: (rect) ->
    if (rect.top < 0)
      rect.height += rect.top
      rect.top = 0

    if (rect.left < 0)
      rect.width += rect.left
      rect.left = 0

    if (rect.top >= window.innerHeight - 4 || rect.left  >= window.innerWidth - 4)
      null
    else
      rect

  getClientRectsForAreas: (imgClientRect, areas) ->
    rects = []
    for area in areas
      coords = area.coords.split(",").map((coord) -> parseInt(coord, 10))
      shape = area.shape.toLowerCase()
      if shape == "rect" or coords.length == 4
        [x1, y1, x2, y2] = coords
      else if shape == "circle" or coords.length == 3
        [x, y, r] = coords
        x1 = x - r
        x2 = x + r
        y1 = y - r
        y2 = y + r
      else
        # Just consider the rectangle surrounding the first two points in a polygon. It's possible to do
        # something more sophisticated, but likely not worth the effort.

      rect = Rect.translate (Rect.create x1, y1, x2, y2), imgClientRect.left, imgClientRect.top
      rect = @cropRectToVisible rect

      rects.push {element: area, rect: rect} if rect and not isNaN rect.top
    rects

  #
