|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.htmlunit.corejs.javascript.ScriptableObject
com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
com.gargoylesoftware.htmlunit.javascript.host.Range
public class Range
The JavaScript object that represents a Range.
| Field Summary | |
|---|---|
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. |
| Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
| Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable |
|---|
NOT_FOUND |
| Constructor Summary | |
|---|---|
Range()
Creates a new instance. |
|
Range(HTMLDocument document)
Creates a new instance. |
|
| Method Summary | |
|---|---|
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. |
boolean |
getCollapsed()
Indicates if the range is collapsed. |
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. |
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. |
String |
toString()
Returns the text of the Range. |
SimpleRange |
toW3C()
Returns a W3C Range version of this object. |
| Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable |
|---|
clone, defineFunctionProperties, defineProperty, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement, setParentScope |
| Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setPrototype, size |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public 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
| Constructor Detail |
|---|
public Range()
public Range(HTMLDocument document)
document - the HTML document creating the range| Method Detail |
|---|
public Object getDefaultValue(Class<?> hint)
getDefaultValue in interface net.sourceforge.htmlunit.corejs.javascript.ScriptablegetDefaultValue in class SimpleScriptablehint - 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 initialized
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 boolean getCollapsed()
true if the range is collapsed
public 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 fragment
public Object extractContents()
public SimpleRange toW3C()
Range version of this object.
Range version of this object
public Object compareBoundaryPoints(int how,
Range sourceRange)
how - a constant describing the comparison methodsourceRange - the Range to compare boundary points with this range
public 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 toString()
toString in class Objectprotected Object equivalentValues(Object value)
SimpleScriptable
equivalentValues in class SimpleScriptable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||