Creating ranges

See http://devdocs.io/dom/document/createrange

var range = document.createRange()

Methods

See http://devdocs.io/dom/range

range
  .setStart(startNode, startOffset)
  .setEnd(endNode, endOffset)

  .setStartBefore(node)
  .setStartAfter(node)
  .setEndBefore(node)
  .setEndAfter(node)

  .selectNode(node)
  .selectNodeContents(node)

Collapsing

range
  .collapse()     // to end (a single point)
  .collapse(true) // to start (a single point)
  .collapsed      // true | false

Operations

range
  .cloneContents()   // copy => DocumentFragment
  .extractContents() // cut  => DocumentFragment
  .deleteContents()  // delete

  .insertNode(node)

Etc

range
  .toString()

Read-only attributes

range
  .collapsed         // true/false
  .startContainer    // Node
  .startOffset
  .endContainer      // Node
  .endOffset
  .commonAncestorContainer // closest of start and end containers