def setRange(self, arg1, arg2=None): """ Sets the range to encompass the given element. May not work around non-text containing elements. @param element Element to surround by this range @return whether a range can be placed around this element. Set the range to be between the two given points. Both points must be within the same document, and end must come after start. @param startPoint Start point to set the range to @param endPoint End point to set the range to """ if arg2 is None: firstText = RangeUtil.getAdjacentTextElement(arg1, arg1, True, False) lastText = RangeUtil.getAdjacentTextElement(arg1, arg1, False, False) if (firstText is None) or (lastText is None): return False startPoint = RangeEndPoint(firstText, 0) endPoint = RangeEndPoint(lastText, lastText.length) else: startPoint = arg1 endPoint = arg2 assert startPoint.getNode().ownerDocument == endPoint.getNode().ownerDocument self._setRange(startPoint, endPoint) self.m_range = None
def setRange(self, arg1, arg2=None): """ Sets the range to encompass the given element. May not work around non-text containing elements. @param element Element to surround by this range @return whether a range can be placed around this element. Set the range to be between the two given points. Both points must be within the same document, and end must come after start. @param startPoint Start point to set the range to @param endPoint End point to set the range to """ if arg2 is None: firstText = RangeUtil.getAdjacentTextElement( arg1, arg1, True, False) lastText = RangeUtil.getAdjacentTextElement( arg1, arg1, False, False) if (firstText is None) or (lastText is None): return False startPoint = RangeEndPoint(firstText, 0) endPoint = RangeEndPoint(lastText, lastText.length) else: startPoint = arg1 endPoint = arg2 assert (startPoint.getNode().ownerDocument == endPoint.getNode().ownerDocument) self._setRange(startPoint, endPoint) self.m_range = None
def setRange(self, arg1, arg2=None): if arg2 is None: firstText = RangeUtil.getAdjacentTextElement(arg1, arg1, True, False) lastText = RangeUtil.getAdjacentTextElement(arg1, arg1, False, False) if (firstText is None) or (lastText is None): return False startPoint = RangeEndPoint(firstText, 0) endPoint = RangeEndPoint(lastText, lastText.length) else: startPoint = arg1 endPoint = arg2 assert startPoint.getNode().ownerDocument == endPoint.getNode().ownerDocument self._setRange(startPoint, endPoint) self.m_range = None
def setRange(self, arg1, arg2=None): if arg2 is None: firstText = RangeUtil.getAdjacentTextElement(arg1, arg1, True, False) lastText = RangeUtil.getAdjacentTextElement(arg1, arg1, False, False) if (firstText is None) or (lastText is None): return False startPoint = RangeEndPoint(firstText, 0) endPoint = RangeEndPoint(lastText, lastText.length) else: startPoint = arg1 endPoint = arg2 assert (startPoint.getNode().ownerDocument == endPoint.getNode().ownerDocument) self._setRange(startPoint, endPoint) self.m_range = None