public class Range extends AbstractRange
org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction| 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_CONSTNOT_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.
|
Range |
cloneRange()
Returns a clone of the range.
|
void |
collapse(boolean toStart)
Collapse a Range onto one of its boundaries.
|
int |
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.
|
DOMRect |
getBoundingClientRect()
Returns an object that bounds the contents of the range.
|
DOMRectList |
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, isCollapsedclone, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromiseapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkSlotRemoval, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, 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, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, sizecreateSlotMappublic 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 AbstractRangepublic 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 int 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 Range cloneRange()
public void detach()
public String jsToString()
public DOMRectList getClientRects()
public DOMRect getBoundingClientRect()
Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.