|
||||||||||
| 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.Node
com.gargoylesoftware.htmlunit.javascript.host.EventNode
com.gargoylesoftware.htmlunit.javascript.host.Element
public class Element
A JavaScript object for DomElement.
| Field Summary |
|---|
| Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node |
|---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
| 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 | |
|---|---|
Element()
|
|
| Method Summary | |
|---|---|
protected NamedNodeMap |
createAttributesObject()
Creates the JS object for the property attributes. |
protected String |
fixAttributeName(String attributeName)
Allows subclasses to transform the attribute name before it gets used. |
Object |
getAttribute(String attributeName,
Integer flags)
Returns the value of the specified attribute. |
Object |
getAttributeNode(String name)
Retrieves an attribute node by name. |
String |
getAttributeNS(String namespaceURI,
String localName)
Gets the specified attribute. |
Object |
getAttributes()
Returns the attributes of this XML element. |
String |
getBaseURI()
Returns the Base URI as a string. |
ClientRect |
getBoundingClientRect()
Retrieves an object that specifies the bounds of a collection of TextRectangle objects. |
int |
getChildElementCount()
Returns the current number of child elements. |
HTMLCollection |
getChildren()
Gets the children of the current node. |
DOMTokenList |
getClassList()
Gets the token list of class attribute. |
ComputedCSSStyleDeclaration |
getCurrentStyle()
Returns the current (calculated) style object for this element. |
DomElement |
getDomNodeOrDie()
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found. |
HTMLCollection |
getElementsByTagName(String tagName)
Returns all the descendant elements with the specified tag name. |
Object |
getElementsByTagNameNS(Object namespaceURI,
String localName)
Returns a list of elements with the given tag name belonging to the given namespace. |
Element |
getFirstElementChild()
Returns the first element child. |
Element |
getLastElementChild()
Returns the last element child. |
Element |
getNextElementSibling()
Returns the next element sibling. |
Element |
getParentElement()
Gets the first ancestor instance of Element. |
Element |
getPreviousElementSibling()
Returns the previous element sibling. |
CSSStyleDeclaration |
getRuntimeStyle()
Returns the runtime style object for this element. |
CSSStyleDeclaration |
getStyle()
Returns the style object for this element. |
String |
getTagName()
Returns the tag name of this element. |
String |
getText()
Represents the text content of the node or the concatenated text representing the node and its descendants. |
boolean |
hasAttribute(String name)
Returns true when an attribute with a given name is specified on this element or has a default value. |
boolean |
hasAttributeNS(String namespaceURI,
String localName)
Test for attribute. |
void |
removeAttribute(String name)
Removes the specified attribute. |
void |
removeAttributeNS(String namespaceURI,
String localName)
Removes the specified attribute. |
HTMLCollection |
selectNodes(String expression)
Applies the specified XPath expression to this node's context and returns the generated list of matching nodes. |
Object |
selectSingleNode(String expression)
Applies the specified pattern-matching operation to this node's context and returns the first matching node. |
void |
setAttribute(String name,
String value)
Sets an attribute. |
Attr |
setAttributeNode(Attr newAtt)
Sets the attribute node for the specified attribute. |
void |
setAttributeNS(String namespaceURI,
String qualifiedName,
String value)
Sets the specified attribute. |
void |
setDefaults(ComputedCSSStyleDeclaration style)
Callback method which allows different HTML element types to perform custom initialization of computed styles. |
void |
setDomNode(DomNode domNode)
Sets the DOM node that corresponds to this JavaScript object. |
| Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode |
|---|
fireEvent, getOnblur, getOnclick, getOncontextmenu, getOndblclick, getOnerror, getOnfocus, getOnfocusin, getOnfocusout, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnpropertychange, getOnresize, setOnblur, setOnclick, setOncontextmenu, setOndblclick, setOnerror, setOnfocus, setOnfocusin, setOnfocusout, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnpropertychange, setOnresize |
| Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node |
|---|
addEventListener, appendChild, asJavaScriptException, attachEvent, cloneNode, compareDocumentPosition, contains, detachEvent, executeEvent, fireEvent, fireEvent, getBaseName, getChildNodes, getEventHandler, getEventHandlerProp, getFirstChild, getJavaScriptNode, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPrefix, getPreviousSibling, getTextContent, getXml, hasChildNodes, hasEventHandlers, insertBefore, insertBeforeImpl, isSameNode, normalize, removeChild, removeEventListener, replaceChild, setEventHandler, setEventHandlerProp, setNodeValue, setTextContent |
| Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable |
|---|
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, 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, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Element()
| Method Detail |
|---|
public void setDomNode(DomNode domNode)
SimpleScriptable
setDomNode in class SimpleScriptabledomNode - the DOM nodepublic HTMLCollection selectNodes(String expression)
expression - a string specifying an XPath expression
public Object selectSingleNode(String expression)
expression - a string specifying an XPath expression
public String getTagName()
public Object getAttributes()
getAttributes in class Nodepublic String getBaseURI()
protected NamedNodeMap createAttributesObject()
public Object getAttribute(String attributeName,
Integer flags)
attributeName - attribute nameflags - IE-specific flags (see the MSDN documentation for more info)
null if the attribute is not definedprotected String fixAttributeName(String attributeName)
attributeName - the original attribute
public void setAttribute(String name,
String value)
name - Name of the attribute to setvalue - Value to set the attribute topublic HTMLCollection getElementsByTagName(String tagName)
tagName - the name to search for
public Object getAttributeNode(String name)
name - the name of the attribute to retrieve
null if there is no such attributepublic String getText()
public Object getElementsByTagNameNS(Object namespaceURI,
String localName)
namespaceURI - the namespace URI of elements to look forlocalName - is either the local name of elements to look for or the special value "*",
which matches all elements.
public boolean hasAttribute(String name)
name - the name of the attribute to look for
public DomElement getDomNodeOrDie()
getDomNodeOrDie in class SimpleScriptablepublic void removeAttribute(String name)
name - the name of the attribute to removepublic ClientRect getBoundingClientRect()
public int getChildElementCount()
public Element getFirstElementChild()
public Element getLastElementChild()
public Element getNextElementSibling()
public Element getPreviousElementSibling()
public Element getParentElement()
Element. It is mostly identical
to Node.getParent() except that it skips non Element nodes.
getParentElement in class NodeNode.getParent()public void setDefaults(ComputedCSSStyleDeclaration style)
style - the style to initializepublic HTMLCollection getChildren()
public DOMTokenList getClassList()
public String getAttributeNS(String namespaceURI,
String localName)
namespaceURI - the namespace URIlocalName - the local name of the attribute to look for
null if the attribute is not defined
public boolean hasAttributeNS(String namespaceURI,
String localName)
namespaceURI - the namespace URIlocalName - the local name of the attribute to look for
true if the node has this attribute
public void setAttributeNS(String namespaceURI,
String qualifiedName,
String value)
namespaceURI - the namespace URIqualifiedName - the qualified name of the attribute to look forvalue - the new attribute value
public void removeAttributeNS(String namespaceURI,
String localName)
namespaceURI - the namespace URI of the attribute to removelocalName - the local name of the attribute to removepublic CSSStyleDeclaration getStyle()
public CSSStyleDeclaration getRuntimeStyle()
public ComputedCSSStyleDeclaration getCurrentStyle()
public Attr setAttributeNode(Attr newAtt)
newAtt - the attribute to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||