public class Range extends HtmlUnitScriptable
| Modifier and Type | Field and Description |
|---|---|
static short |
END_TO_END
Comparison mode for compareBoundaryPoints.
|
static short |
END_TO_START
Comparison mode for compareBoundaryPoints.
|
static short |
START_TO_END
Comparison mode for compareBoundaryPoints.
|
static short |
START_TO_START
Comparison mode for compareBoundaryPoints.
|
| Constructor and Description |
|---|
Range()
Creates an instance.
|
Range(Document document)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
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.
|
Object |
createContextualFragment(String valueAsString)
Parses an HTML snippet.
|
void |
deleteContents()
Deletes the contents of the range.
|
void |
detach()
Releases Range from use to improve performance.
|
protected Object |
equivalentValues(Object value) |
Object |
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.
|
Object |
getDefaultValue(Class<?> hint)
Returns the JavaScript default value of this object.
|
Object |
getEndContainer()
Gets the node within which the Range ends.
|
int |
getEndOffset()
Gets the offset within the end node of the Range.
|
Object |
getStartContainer()
Gets the node within which the Range begins.
|
int |
getStartOffset()
Gets the offset within the starting node of the Range.
|
void |
insertNode(Node newNode)
Inserts a new node at the beginning of the range.
|
boolean |
isCollapsed()
Indicates if the range is collapsed.
|
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.
|
SimpleRange |
toW3C()
Returns a W3C
Range version of this object. |
clone, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScopeapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, 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, sizepublic static final short START_TO_START
public static final short START_TO_END
public static final short END_TO_END
public static final short END_TO_START
public Range()
public Range(Document document)
document - the HTML document creating the rangepublic Object getDefaultValue(Class<?> hint)
getDefaultValue in interface net.sourceforge.htmlunit.corejs.javascript.ScriptablegetDefaultValue in class HtmlUnitScriptablehint - a hint as to the format of the default value (ignored in this case)public Object getStartContainer()
undefined if not initializedpublic Object getEndContainer()
undefined if not initializedpublic int getStartOffset()
0 if not initializedpublic int getEndOffset()
0 if not initializedpublic 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 boolean isCollapsed()
true if the range is collapsedpublic 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 Object createContextualFragment(String valueAsString)
valueAsString - text that contains text and tags to be converted to a document fragmentpublic Object extractContents()
public SimpleRange toW3C()
Range version of this object.Range version of this objectpublic Object compareBoundaryPoints(int how, Range sourceRange)
how - a constant describing the comparison methodsourceRange - the Range to compare boundary points with this rangepublic Object 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()
protected Object equivalentValues(Object value)
HtmlUnitScriptableequivalentValues in class HtmlUnitScriptablepublic ClientRectList getClientRects()
public ClientRect getBoundingClientRect()
Copyright © 2002–2022 Gargoyle Software Inc.. All rights reserved.