def getSelection(window=None): global m_selection global m_document if window is None: window = getWindow() m_selection = SelectionImpl.getSelection(window) m_document = getDocument(window)
def getRange(): jsRange = SelectionImpl.getJSRange(m_document, m_selection) if jsRange is None: return None res = Range(m_document, jsRange) res.ensureEndPoints() return res
def clear(): SelectionImpl.clear(m_selection)
def setRange(newSelection): if newSelection.getDocument() == m_document: SelectionImpl.setJSRange(m_selection, newSelection.getJSRange())