getDocument () {
    var doc = this._internal.doc
    if (!doc) {
      throw new Error('Selection is not attached to a document.')
    }
    return doc
  }
@returns {Document} The attached document instance