 
     # create our range, and select it
     range = @rootWin.document.createRange()
-    range.setStartBefore node
-    range.setEndAfter node
+
+    # work-around 2 for table selection inconsistency issue,
+    # See https://github.com/hypothesis/h/issues/280
+    if USE_TH_TBODY_WORKAROUND and node.nodeType is Node.ELEMENT_NODE and
+        node.tagName.toLowerCase() in ["thead", "tbody"] and node.hasChildNodes()
+      # This is a thead or a tbody, and selection those is problematic,
+      # because if the WebKit bug.
+      # (Sometimes it selects nothing, sometimes it selects the whole table.)
+      # So we select directly the children instead.
+      children = node.childNodes
+      range.setStartBefore children[0]
+      range.setEndAfter children[children.length - 1]
+    else
+      range.setStartBefore node
+      range.setEndAfter node
+
     sel.addRange range
     if scroll
       sn = node


  # ===== Private methods (never call from outside the module) =======

  timestamp: -> new Date().getTime()

  stringStartsWith: (string, prefix) -> prefix is string.substr 0, prefix.length

    startIndex = if parentContent? then (parentContent.indexOf content, index) else index
    if startIndex is -1
       # content of node is not present in parent's content - probably hidden, or something similar
#       console.log "Content of this not is not present in content of parent, at path " + path
       return index


