public class Range extends AbstractRange
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
Modifier and Type | Field and Description |
---|---|
static int |
END_TO_END
Comparison mode for compareBoundaryPoints.
|
static int |
END_TO_START
Comparison mode for compareBoundaryPoints.
|
static int |
START_TO_END
Comparison mode for compareBoundaryPoints.
|
static int |
START_TO_START
Comparison mode for compareBoundaryPoints.
|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
Range()
Creates an instance.
|
Range(Document document)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
HtmlUnitScriptable |
cloneContents()
Returns a clone of the range in a document fragment.
|
Object |
cloneRange()
Returns a clone of the range.
|
void |
collapse(boolean toStart)
Collapse a Range onto one of its boundaries.
|
Object |
compareBoundaryPoints(int how,
Range sourceRange)
Compares the boundary points of two Ranges.
|
HtmlUnitScriptable |
createContextualFragment(String valueAsString)
Parses an HTML snippet.
|
void |
deleteContents()
Deletes the contents of the range.
|
void |
detach()
Releases Range from use to improve performance.
|
HtmlUnitScriptable |
extractContents()
Moves this range's contents from the document tree into a document fragment.
|
ClientRect |
getBoundingClientRect()
Returns an object that bounds the contents of the range.
|
ClientRectList |
getClientRects()
Retrieves a collection of rectangles that describes the layout of the contents of an object
or range within the client.
|
Object |
getCommonAncestorContainer()
Returns the deepest common ancestor container of the Range's two boundary points.
|
void |
insertNode(Node newNode)
Inserts a new node at the beginning of the range.
|
void |
jsConstructor()
JavaScript constructor.
|
String |
jsToString()
Returns the text of the Range.
|
void |
selectNode(Node refNode)
Selects a node and its contents.
|
void |
selectNodeContents(Node refNode)
Select the contents within a node.
|
void |
setEnd(Node refNode,
int offset)
Sets the attributes describing the end of a Range.
|
void |
setEndAfter(Node refNode)
Sets the end of the range to be after the node.
|
void |
setEndBefore(Node refNode)
Sets the end of the range to be before the node.
|
void |
setStart(Node refNode,
int offset)
Sets the attributes describing the start of a Range.
|
void |
setStartAfter(Node refNode)
Sets the start of the range to be after the node.
|
void |
setStartBefore(Node refNode)
Sets the start of the range to be before the node.
|
void |
surroundContents(Node newNode)
Surrounds the contents of the range in a new node.
|
equivalentValues, getDefaultValue, getEndContainer, getEndOffset, getSimpleRange, getStartContainer, getStartOffset, internGetEndContainer, internGetEndOffset, internGetStartContainer, internGetStartOffset, internSetEndContainer, internSetEndOffset, internSetStartContainer, internSetStartOffset, isCollapsed
clone, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
public static final int START_TO_START
public static final int START_TO_END
public static final int END_TO_END
public static final int END_TO_START
public Range()
public Range(Document document)
document
- the HTML document creating the rangepublic void jsConstructor()
jsConstructor
in class AbstractRange
public void setStart(Node refNode, int offset)
refNode
- the reference nodeoffset
- the offset value within the nodepublic void setStartAfter(Node refNode)
refNode
- the reference nodepublic void setStartBefore(Node refNode)
refNode
- the reference nodepublic void setEnd(Node refNode, int offset)
refNode
- the reference nodeoffset
- the offset value within the nodepublic void setEndAfter(Node refNode)
refNode
- the reference nodepublic void setEndBefore(Node refNode)
refNode
- the reference nodepublic void selectNodeContents(Node refNode)
refNode
- Node to select frompublic void selectNode(Node refNode)
refNode
- the node to selectpublic void collapse(boolean toStart)
toStart
- if true
, collapses the Range onto its start; else collapses it onto its endpublic Object getCommonAncestorContainer()
public HtmlUnitScriptable createContextualFragment(String valueAsString)
valueAsString
- text that contains text and tags to be converted to a document fragmentpublic HtmlUnitScriptable extractContents()
public Object compareBoundaryPoints(int how, Range sourceRange)
how
- a constant describing the comparison methodsourceRange
- the Range to compare boundary points with this rangepublic HtmlUnitScriptable cloneContents()
public void deleteContents()
public void insertNode(Node newNode)
newNode
- The node to insertpublic void surroundContents(Node newNode)
newNode
- The node to surround the range inpublic Object cloneRange()
public void detach()
public String jsToString()
public ClientRectList getClientRects()
public ClientRect getBoundingClientRect()
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.