com.gargoylesoftware.htmlunit.javascript.host.html
Class HTMLElement

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Node
              extended by com.gargoylesoftware.htmlunit.javascript.host.EventNode
                  extended by com.gargoylesoftware.htmlunit.javascript.host.Element
                      extended by com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
All Implemented Interfaces:
ScriptableWithFallbackGetter, Serializable, Cloneable, Map, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable
Direct Known Subclasses:
FormChild, HTMLAnchorElement, HTMLAppletElement, HTMLAreaElement, HTMLAudioElement, HTMLBaseElement, HTMLBaseFontElement, HTMLBodyElement, HTMLBRElement, HTMLCanvasElement, HTMLDelElement, HTMLDivElement, HTMLEmbedElement, HTMLFontElement, HTMLFormElement, HTMLFrameElement, HTMLFrameSetElement, HTMLHeadElement, HTMLHeadingElement, HTMLHRElement, HTMLHtmlElement, HTMLIFrameElement, HTMLImageElement, HTMLInsElement, HTMLIsIndexElement, HTMLLIElement, HTMLLinkElement, HTMLListElement, HTMLMapElement, HTMLMetaElement, HTMLOptGroupElement, HTMLParagraphElement, HTMLParamElement, HTMLPreElement, HTMLQuoteElement, HTMLScriptElement, HTMLSourceElement, HTMLSpacerElement, HTMLSpanElement, HTMLStyleElement, HTMLTableCaptionElement, HTMLTableComponent, HTMLTitleElement, HTMLUnknownElement, HTMLVideoElement, HTMLWBRElement, RowContainer

public class HTMLElement
extends Element
implements ScriptableWithFallbackGetter

The JavaScript object "HTMLElement" which is the base class for all HTML objects. This will typically wrap an instance of HtmlElement.

Version:
$Revision: 5864 $
Author:
Mike Bowler, David K. Taylor, Barnaby Court, Christian Sell, Chris Erskine, David D. Kilzer, Daniel Gredler, Marc Guillemot, Hans Donner, Bruce Faulkner, Ahmed Ashour, Sudhan Moghe
See Also:
Serialized Form

Nested Class Summary
static class HTMLElement.ProxyDomNode
          ProxyDomNode.
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static int BEHAVIOR_ID_CLIENT_CAPS
          BEHAVIOR_ID_CLIENT_CAPS.
static int BEHAVIOR_ID_DOWNLOAD
          BEHAVIOR_ID_DOWNLOAD.
static int BEHAVIOR_ID_HOMEPAGE
          BEHAVIOR_ID_HOMEPAGE.
 
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
HTMLElement()
          Creates an instance.
 
Method Summary
 void addComponentRequest(String id, String idType, String minVersion)
          Adds the specified component to the queue of components to be installed.
 void clearComponentRequest()
          Clears the component install queue of all component requests.
 int compareVersions(String v1, String v2)
          Compares the two specified version numbers.
protected  void createEventHandler(String eventName, String attrValue)
          Create the event handler function from the attribute value.
 boolean doComponentRequest()
          Downloads all the components queued via addComponentRequest(String, String, String).
protected  String fixAttributeName(String attributeName)
          For IE, foo.getAttribute(x) uses same names as foo.x.
protected  String getAlign(boolean returnInvalidValues)
          Returns the value of the "align" property.
 int getAvailHeight()
          Returns the screen's available height.
 int getAvailWidth()
          Returns the screen's available width.
 BoxObject getBoxObject()
          Returns the BoxObject for this element.
 int getBufferDepth()
          Returns the screen's buffer depth.
protected  String getCh()
          Returns the value of the "ch" property.
protected  String getChOff()
          Returns the value of the "chOff" property.
 int getColorDepth()
          Returns the screen's color depth.
 String getComponentVersion(String id, String idType)
          Returns the version of the specified component.
 String getConnectionType()
          Returns the connection type being used.
 boolean getCookieEnabled()
          Returns true if cookies are enabled.
 String getCpuClass()
          Returns the type of CPU used.
 HtmlElement getDomNodeOrDie()
          Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.
 HtmlElement getDomNodeOrNull()
          Returns the DOM node that corresponds to this JavaScript object or null if a node hasn't been set.
 int getHeight()
          Returns the screen's height.
 boolean getJavaEnabled()
          Returns true if Java is enabled.
 HTMLElement getParentHTMLElement()
          Gets the first ancestor instance of HTMLElement.
 String getPlatform()
          Returns the platform used.
 int getPosX()
          Returns this element's X position.
 int getPosY()
          Returns this element's Y position.
 String getSystemLanguage()
          Returns the system language.
 String getUserLanguage()
          Returns the user language.
protected  String getVAlign(String[] valid, String defaultValue)
          Returns the value of the "vAlign" property.
 int getWidth()
          Returns the screen's width.
protected  String getWidthOrHeight(String attributeName, Boolean returnNegativeValues)
          Returns the value of the specified attribute (width or height).
 Object getWithFallback(String name)
          Looks at attributes with the given name.
protected  boolean isAncestorOfEventTarget(MouseEvent event)
          Returns true if this element's node is an ancestor of the specified event's target node.
protected  boolean isAttributeName(String name)
          Indicates if this is the name of a well defined attribute that can be access as property.
 boolean isComponentInstalled(String id, String idType, String minVersion)
          Returns true if the specified component is installed.
 boolean isHomePage(String url)
          Returns true if the specified URL is the web client's current homepage and the document calling the method is on the same domain as the user's homepage.
 int jsxFunction_addBehavior(String behavior)
          Adds the specified behavior to this HTML element.
 void jsxFunction_blur()
          Remove focus from this element.
 void jsxFunction_clearAttributes()
          An IE-only method which clears all custom attributes.
 void jsxFunction_click()
          Click this element.
 boolean jsxFunction_contains(HTMLElement element)
          Checks whether the given element is contained within this object.
 Object jsxFunction_createTextRange()
          Creates a new TextRange object for this element.
 boolean jsxFunction_dispatchEvent(Event event)
          Dispatches an event into the event system (standards-conformant browsers only).
 void jsxFunction_doScroll(String scrollAction)
          Simulates a click on a scrollbar component (IE only).
 void jsxFunction_focus()
          Sets the focus to this element.
 Object jsxFunction_getAttributeNode(String attributeName)
          Gets the attribute node for the specified attribute.
 Object jsxFunction_getAttributeNodeNS(String namespaceURI, String localName)
          Returns the specified attribute.
 String jsxFunction_getAttributeNS(String namespaceURI, String localName)
          Gets the specified attribute.
 TextRectangle jsxFunction_getBoundingClientRect()
          Retrieves an object that specifies the bounds of a collection of TextRectangle objects.
 Object jsxFunction_getClientRects()
          Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client.
 HTMLCollection jsxFunction_getElementsByClassName(String className)
          Returns all the descendant elements with the specified class.
 Object jsxFunction_getElementsByTagName(String tagName)
          Returns all the descendant elements with the specified tag name.
 boolean jsxFunction_hasAttributeNS(String namespaceURI, String localName)
          Test for attribute.
 Object jsxFunction_insertAdjacentElement(String where, Object object)
          Inserts the given element into the element at the location.
 void jsxFunction_insertAdjacentHTML(String where, String text)
          Inserts the given HTML text into the element at the location.
 void jsxFunction_mergeAttributes(HTMLElement source, Object preserveIdentity)
          An IE-only method which copies all custom attributes from the specified source element to this element.
 void jsxFunction_removeAttributeNode(Attr attribute)
          Removes the specified attribute.
 void jsxFunction_removeAttributeNS(String namespaceURI, String localName)
          Removes the specified attribute.
 void jsxFunction_removeBehavior(int id)
          Removes the behavior corresponding to the specified identifier from this element.
 boolean jsxFunction_removeExpression(String propertyName)
          Removes the expression from the specified property.
 HTMLElement jsxFunction_removeNode(boolean removeChildren)
          Removes this object from the document hierarchy.
 void jsxFunction_scrollIntoView()
          Implement the scrollIntoView() JavaScript function but don't actually do anything.
 void jsxFunction_setActive()
          Sets the object as active without setting focus to the object.
 void jsxFunction_setAttribute(String name, String value)
          Sets an attribute.
 Attr jsxFunction_setAttributeNode(Attr newAtt)
          Sets the attribute node for the specified attribute.
 void jsxFunction_setAttributeNS(String namespaceURI, String qualifiedName, String value)
          Sets the specified attribute.
 void jsxFunction_setExpression(String propertyName, String expression, String language)
          Sets an expression for the specified HTMLElement.
 String jsxGet_accessKey()
          Returns the "accessKey" property.
 HTMLCollection jsxGet_all()
          Returns the value of the "all" property.
 HTMLCollection jsxGet_children()
          Gets the children of the current node.
 Object jsxGet_className()
          Returns the class defined for this element.
 int jsxGet_clientHeight()
          Returns "clientHeight" attribute.
 int jsxGet_clientLeft()
          Returns "clientLeft" attribute.
 int jsxGet_clientTop()
          Returns "clientTop" attribute.
 int jsxGet_clientWidth()
          Returns "clientWidth" attribute.
 ComputedCSSStyleDeclaration jsxGet_currentStyle()
          Returns the current (calculated) style object for this element.
 String jsxGet_dir()
          Returns the "dir" property.
 boolean jsxGet_disabled()
          Returns true if this element is disabled.
 HTMLDocumentProxy jsxGet_document()
          Returns the document.
 Object jsxGet_filters()
          Gets the filters.
 String jsxGet_id()
          Returns the element ID.
 String jsxGet_innerHTML()
          Gets the innerHTML attribute.
 String jsxGet_innerText()
          Gets the innerText attribute.
 String jsxGet_lang()
          Returns the "lang" property.
 String jsxGet_language()
          Returns the "language" property.
 String jsxGet_localName()
          Returns the local name of this element.
 String jsxGet_namespaceURI()
          Returns The URI that identifies an XML namespace.
 String jsxGet_nodeName()
          Gets the JavaScript property "nodeName" for the current node.
 int jsxGet_offsetHeight()
          Returns this element's offsetHeight, which is the element height plus the element's padding plus the element's border.
 int jsxGet_offsetLeft()
          Returns this element's offsetLeft, which is the calculated left position of this element relative to the offsetParent.
 Object jsxGet_offsetParent()
          Returns this element's offsetParent.
 int jsxGet_offsetTop()
          Returns this element's offsetTop, which is the calculated top position of this element relative to the offsetParent.
 int jsxGet_offsetWidth()
          Returns this element's offsetWidth, which is the element width plus the element's padding plus the element's border.
 String jsxGet_outerHTML()
          Gets the outerHTML of the node.
 HTMLElement jsxGet_parentElement()
          Gets the JavaScript property "parentElement".
 String jsxGet_prefix()
          Returns the namespace prefix.
 CSSStyleDeclaration jsxGet_runtimeStyle()
          Returns the runtime style object for this element.
 String jsxGet_scopeName()
          Gets the namespace defined for the element.
 int jsxGet_scrollHeight()
          Gets the scrollHeight for this element.
 int jsxGet_scrollLeft()
          Gets the scrollLeft value for this element.
 int jsxGet_scrollTop()
          Gets the scrollTop value for this element.
 int jsxGet_scrollWidth()
          Gets the scrollWidth for this element.
 boolean jsxGet_spellcheck()
          Returns the "spellcheck" property.
 CSSStyleDeclaration jsxGet_style()
          Returns the style object for this element.
 int jsxGet_tabIndex()
          Returns the value of the tabIndex attribute.
 String jsxGet_tagUrn()
          Gets the Uniform Resource Name (URN) specified in the namespace declaration.
 String jsxGet_title()
          Returns the element title.
 String jsxGet_uniqueID()
          Retrieves an auto-generated, unique identifier for the object.
 void jsxSet_accessKey(String accessKey)
          Sets the "accessKey" property.
 void jsxSet_className(String className)
          Sets the class attribute for this element.
 void jsxSet_dir(String dir)
          Sets the "dir" property.
 void jsxSet_disabled(boolean disabled)
          Sets whether or not to disable this element.
 void jsxSet_id(String newId)
          Sets the identifier this element.
 void jsxSet_innerHTML(Object value)
          Replace all children elements of this element with the supplied value.
 void jsxSet_innerText(String value)
          Replace all children elements of this element with the supplied value.
 void jsxSet_lang(String lang)
          Sets the "lang" property.
 void jsxSet_language(String language)
          Sets the "language" property.
 void jsxSet_outerHTML(String value)
          Replace all children elements of this element with the supplied value.
 void jsxSet_scrollLeft(int scroll)
          Sets the scrollLeft value for this element.
 void jsxSet_scrollTop(int scroll)
          Sets the scrollTop value for this element.
 void jsxSet_spellcheck(boolean spellcheck)
          Sets the "spellcheck" property.
 void jsxSet_tabIndex(int tabIndex)
          Sets the "tabIndex" property.
 void jsxSet_tagUrn(String tagUrn)
          Sets the Uniform Resource Name (URN) specified in the namespace declaration.
 void jsxSet_textContent(Object value)
          Replace all children elements of this element with the supplied value.
 void jsxSet_title(String newTitle)
          Sets the title of this element.
 void navigateHomePage()
          Causes the web client to navigate to the current home page.
static void parseHtmlSnippet(DomNode target, boolean append, String source)
          Parses the specified HTML source code, appending the resultant content at the specified target location.
protected  org.xml.sax.helpers.AttributesImpl readAttributes(HtmlElement element)
          Gets the attributes of the element in the form of a Attributes.
protected  void setAlign(String align, boolean ignoreIfNoError)
          Sets the value of the "align" property.
protected  void setCh(String ch)
          Sets the value of the "ch" property.
protected  void setChOff(String chOff)
          Sets the value of the "chOff" property.
protected  void setColorAttribute(String name, String value)
          Sets the specified color attribute to the specified value.
 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.
 void setHomePage(String url)
          Sets the web client's current homepage.
protected  void setVAlign(Object vAlign, String[] valid)
          Sets the value of the "vAlign" property.
protected  void setWidthOrHeight(String attributeName, String value, Boolean allowNegativeValues)
          Sets the value of the specified attribute (width or height).
 void startDownload(String uri, net.sourceforge.htmlunit.corejs.javascript.Function callback)
          Implementation of the IE behavior #default#download.
 String toString()
          
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Element
createAttributesObject, jsxFunction_getAttribute, jsxFunction_getElementsByTagNameNS, jsxFunction_hasAttribute, jsxFunction_removeAttribute, jsxFunction_selectNodes, jsxFunction_selectSingleNode, jsxGet_attributes, jsxGet_tagName, jsxGet_text
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode
jsxFunction_fireEvent, jsxGet_onblur, jsxGet_onclick, jsxGet_oncontextmenu, jsxGet_ondblclick, jsxGet_onerror, jsxGet_onfocus, jsxGet_onfocusin, jsxGet_onfocusout, jsxGet_onkeydown, jsxGet_onkeypress, jsxGet_onkeyup, jsxGet_onmousedown, jsxGet_onmousemove, jsxGet_onmouseout, jsxGet_onmouseover, jsxGet_onmouseup, jsxGet_onpropertychange, jsxGet_onresize, jsxSet_onblur, jsxSet_onclick, jsxSet_oncontextmenu, jsxSet_ondblclick, jsxSet_onerror, jsxSet_onfocus, jsxSet_onfocusin, jsxSet_onfocusout, jsxSet_onkeydown, jsxSet_onkeypress, jsxSet_onkeyup, jsxSet_onmousedown, jsxSet_onmousemove, jsxSet_onmouseout, jsxSet_onmouseover, jsxSet_onmouseup, jsxSet_onpropertychange, jsxSet_onresize
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
executeEvent, fireEvent, getEventHandler, getEventHandlerProp, getJavaScriptNode, getParent, hasEventHandlers, jsxFunction_addEventListener, jsxFunction_appendChild, jsxFunction_attachEvent, jsxFunction_cloneNode, jsxFunction_compareDocumentPosition, jsxFunction_detachEvent, jsxFunction_hasChildNodes, jsxFunction_insertBefore, jsxFunction_insertBefore, jsxFunction_isSameNode, jsxFunction_normalize, jsxFunction_removeChild, jsxFunction_removeEventListener, jsxFunction_replaceChild, jsxGet_childNodes, jsxGet_firstChild, jsxGet_lastChild, jsxGet_nextSibling, jsxGet_nodeType, jsxGet_nodeValue, jsxGet_ownerDocument, jsxGet_parentNode, jsxGet_previousSibling, jsxGet_textContent, jsxGet_xml, jsxSet_nodeValue, setEventHandler, setEventHandlerProp
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, clear, containsKey, containsValue, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, entrySet, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, keySet, preventExtensions, put, put, put, putAll, putConst, putConstProperty, putProperty, putProperty, redefineProperty, remove, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
delete, delete, get, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

BEHAVIOR_ID_CLIENT_CAPS

public static final int BEHAVIOR_ID_CLIENT_CAPS
BEHAVIOR_ID_CLIENT_CAPS.

See Also:
Constant Field Values

BEHAVIOR_ID_HOMEPAGE

public static final int BEHAVIOR_ID_HOMEPAGE
BEHAVIOR_ID_HOMEPAGE.

See Also:
Constant Field Values

BEHAVIOR_ID_DOWNLOAD

public static final int BEHAVIOR_ID_DOWNLOAD
BEHAVIOR_ID_DOWNLOAD.

See Also:
Constant Field Values
Constructor Detail

HTMLElement

public HTMLElement()
Creates an instance.

Method Detail

jsxGet_all

public HTMLCollection jsxGet_all()
Returns the value of the "all" property.

Returns:
the value of the "all" property

jsxGet_style

public CSSStyleDeclaration jsxGet_style()
Returns the style object for this element.

Returns:
the style object for this element

jsxGet_currentStyle

public ComputedCSSStyleDeclaration jsxGet_currentStyle()
Returns the current (calculated) style object for this element.

Returns:
the current (calculated) style object for this element

setDefaults

public void setDefaults(ComputedCSSStyleDeclaration style)
Callback method which allows different HTML element types to perform custom initialization of computed styles. For example, body elements in most browsers have default values for their margins.

Parameters:
style - the style to initialize

jsxGet_runtimeStyle

public CSSStyleDeclaration jsxGet_runtimeStyle()
Returns the runtime style object for this element.

Returns:
the runtime style object for this element

setDomNode

public void setDomNode(DomNode domNode)
Sets the DOM node that corresponds to this JavaScript object.

Overrides:
setDomNode in class Node
Parameters:
domNode - the DOM node

createEventHandler

protected void createEventHandler(String eventName,
                                  String attrValue)
Create the event handler function from the attribute value.

Parameters:
eventName - the event name (ex: "onclick")
attrValue - the attribute value

jsxGet_id

public String jsxGet_id()
Returns the element ID.

Returns:
the ID of this element

jsxSet_id

public void jsxSet_id(String newId)
Sets the identifier this element.

Parameters:
newId - the new identifier of this element

jsxGet_title

public String jsxGet_title()
Returns the element title.

Returns:
the ID of this element

jsxSet_title

public void jsxSet_title(String newTitle)
Sets the title of this element.

Parameters:
newTitle - the new identifier of this element

jsxGet_disabled

public boolean jsxGet_disabled()
Returns true if this element is disabled.

Returns:
true if this element is disabled

jsxGet_document

public HTMLDocumentProxy jsxGet_document()
Returns the document.

Returns:
the document

jsxSet_disabled

public void jsxSet_disabled(boolean disabled)
Sets whether or not to disable this element.

Parameters:
disabled - True if this is to be disabled

jsxGet_namespaceURI

public String jsxGet_namespaceURI()
Returns The URI that identifies an XML namespace.

Overrides:
jsxGet_namespaceURI in class Node
Returns:
the URI that identifies an XML namespace

jsxGet_localName

public String jsxGet_localName()
Returns the local name of this element.

Overrides:
jsxGet_localName in class Node
Returns:
the local name of this element

getWithFallback

public Object getWithFallback(String name)
Looks at attributes with the given name. Fallback called when no configured property is found with the given name on the Scriptable object.

Specified by:
getWithFallback in interface ScriptableWithFallbackGetter
Parameters:
name - the name of the requested property
Returns:
the object value, Scriptable.NOT_FOUND if nothing is found

isAttributeName

protected boolean isAttributeName(String name)
Indicates if this is the name of a well defined attribute that can be access as property. Ex: for HtmlInputElement maxlength => false but maxLength => true

Parameters:
name - the name (case sensitive!)
Returns:
false if no standard attribute exists with this name

fixAttributeName

protected String fixAttributeName(String attributeName)
For IE, foo.getAttribute(x) uses same names as foo.x.

Overrides:
fixAttributeName in class Element
Parameters:
attributeName - the name
Returns:
the real name

jsxFunction_clearAttributes

public void jsxFunction_clearAttributes()
An IE-only method which clears all custom attributes.


jsxFunction_mergeAttributes

public void jsxFunction_mergeAttributes(HTMLElement source,
                                        Object preserveIdentity)
An IE-only method which copies all custom attributes from the specified source element to this element.

Parameters:
source - the source element from which to copy the custom attributes
preserveIdentity - if false, the name and id attributes are not copied

jsxFunction_getAttributeNodeNS

public Object jsxFunction_getAttributeNodeNS(String namespaceURI,
                                             String localName)
Returns the specified attribute.

Parameters:
namespaceURI - the namespace URI
localName - the local name of the attribute to look for
Returns:
the specified attribute, null if the attribute is not defined

jsxFunction_getAttributeNS

public String jsxFunction_getAttributeNS(String namespaceURI,
                                         String localName)
Gets the specified attribute.

Parameters:
namespaceURI - the namespace URI
localName - the local name of the attribute to look for
Returns:
the value of the specified attribute, null if the attribute is not defined

jsxFunction_hasAttributeNS

public boolean jsxFunction_hasAttributeNS(String namespaceURI,
                                          String localName)
Test for attribute. See also the DOM reference

Parameters:
namespaceURI - the namespace URI
localName - the local name of the attribute to look for
Returns:
true if the node has this attribute

jsxFunction_setAttribute

public void jsxFunction_setAttribute(String name,
                                     String value)
Sets an attribute. See also the DOM reference

Overrides:
jsxFunction_setAttribute in class Element
Parameters:
name - Name of the attribute to set
value - Value to set the attribute to

jsxFunction_setAttributeNS

public void jsxFunction_setAttributeNS(String namespaceURI,
                                       String qualifiedName,
                                       String value)
Sets the specified attribute.

Parameters:
namespaceURI - the namespace URI
qualifiedName - the qualified name of the attribute to look for
value - the new attribute value

jsxFunction_removeAttributeNS

public void jsxFunction_removeAttributeNS(String namespaceURI,
                                          String localName)
Removes the specified attribute.

Parameters:
namespaceURI - the namespace URI of the attribute to remove
localName - the local name of the attribute to remove

jsxFunction_removeAttributeNode

public void jsxFunction_removeAttributeNode(Attr attribute)
Removes the specified attribute.

Parameters:
attribute - the attribute to remove

jsxFunction_removeNode

public HTMLElement jsxFunction_removeNode(boolean removeChildren)
Removes this object from the document hierarchy.

Parameters:
removeChildren - whether to remove children or no
Returns:
a reference to the object that is removed

jsxFunction_getAttributeNode

public Object jsxFunction_getAttributeNode(String attributeName)
Gets the attribute node for the specified attribute.

Overrides:
jsxFunction_getAttributeNode in class Element
Parameters:
attributeName - the name of the attribute to retrieve
Returns:
the attribute node for the specified attribute

jsxFunction_setAttributeNode

public Attr jsxFunction_setAttributeNode(Attr newAtt)
Sets the attribute node for the specified attribute.

Parameters:
newAtt - the attribute to set
Returns:
the replaced attribute node, if any

jsxFunction_getElementsByTagName

public Object jsxFunction_getElementsByTagName(String tagName)
Returns all the descendant elements with the specified tag name.

Overrides:
jsxFunction_getElementsByTagName in class Element
Parameters:
tagName - the name to search for
Returns:
all the descendant elements with the specified tag name

jsxFunction_getElementsByClassName

public HTMLCollection jsxFunction_getElementsByClassName(String className)
Returns all the descendant elements with the specified class.

Parameters:
className - the name to search for
Returns:
all the descendant elements with the specified class name

jsxGet_className

public Object jsxGet_className()
Returns the class defined for this element.

Returns:
the class name

jsxGet_clientHeight

public int jsxGet_clientHeight()
Returns "clientHeight" attribute.

Returns:
the "clientHeight" attribute

jsxGet_clientWidth

public int jsxGet_clientWidth()
Returns "clientWidth" attribute.

Returns:
the "clientWidth" attribute

jsxGet_clientLeft

public int jsxGet_clientLeft()
Returns "clientLeft" attribute.

Returns:
the "clientLeft" attribute

jsxGet_clientTop

public int jsxGet_clientTop()
Returns "clientTop" attribute.

Returns:
the "clientTop" attribute

jsxSet_className

public void jsxSet_className(String className)
Sets the class attribute for this element.

Parameters:
className - the new class name

jsxGet_innerHTML

public String jsxGet_innerHTML()
Gets the innerHTML attribute.

Returns:
the contents of this node as HTML

jsxGet_innerText

public String jsxGet_innerText()
Gets the innerText attribute.

Returns:
the contents of this node as text

jsxGet_outerHTML

public String jsxGet_outerHTML()
Gets the outerHTML of the node.

Returns:
the contents of this node as HTML
See Also:
MSDN documentation

jsxSet_innerHTML

public void jsxSet_innerHTML(Object value)
Replace all children elements of this element with the supplied value.

Parameters:
value - the new value for the contents of this node

jsxSet_innerText

public void jsxSet_innerText(String value)
Replace all children elements of this element with the supplied value.

Parameters:
value - the new value for the contents of this node

jsxSet_textContent

public void jsxSet_textContent(Object value)
Replace all children elements of this element with the supplied value.

Overrides:
jsxSet_textContent in class Node
Parameters:
value - the new value for the contents of this node

jsxSet_outerHTML

public void jsxSet_outerHTML(String value)
Replace all children elements of this element with the supplied value. Sets the outerHTML of the node.

Parameters:
value - the new value for replacing this node
See Also:
MSDN documentation

parseHtmlSnippet

public static void parseHtmlSnippet(DomNode target,
                                    boolean append,
                                    String source)
Parses the specified HTML source code, appending the resultant content at the specified target location.

Parameters:
target - the node indicating the position at which the parsed content should be placed
append - if true, append the parsed content as a child of the specified target; if false, append the parsed content as the previous sibling of the specified target
source - the HTML code extract to parse

readAttributes

protected org.xml.sax.helpers.AttributesImpl readAttributes(HtmlElement element)
Gets the attributes of the element in the form of a Attributes.

Parameters:
element - the element to read the attributes from
Returns:
the attributes

jsxFunction_insertAdjacentHTML

public void jsxFunction_insertAdjacentHTML(String where,
                                           String text)
Inserts the given HTML text into the element at the location.

Parameters:
where - specifies where to insert the HTML text, using one of the following value: beforeBegin, afterBegin, beforeEnd, afterEnd
text - the HTML text to insert
See Also:
MSDN documentation

jsxFunction_insertAdjacentElement

public Object jsxFunction_insertAdjacentElement(String where,
                                                Object object)
Inserts the given element into the element at the location.

Parameters:
where - specifies where to insert the element, using one of the following value: beforeBegin, afterBegin, beforeEnd, afterEnd
object - the element to insert
Returns:
an element object
See Also:
MSDN documentation

jsxFunction_addBehavior

public int jsxFunction_addBehavior(String behavior)
Adds the specified behavior to this HTML element. Currently only supports the following default IE behaviors:

Parameters:
behavior - the URL of the behavior to add, or a default behavior name
Returns:
an identifier that can be user later to detach the behavior from the element

jsxFunction_removeBehavior

public void jsxFunction_removeBehavior(int id)
Removes the behavior corresponding to the specified identifier from this element.

Parameters:
id - the identifier for the behavior to remove

getAvailHeight

public int getAvailHeight()
Returns the screen's available height. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the screen's available height

getAvailWidth

public int getAvailWidth()
Returns the screen's available width. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the screen's available width

getBufferDepth

public int getBufferDepth()
Returns the screen's buffer depth. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the screen's buffer depth

getBoxObject

public BoxObject getBoxObject()
Returns the BoxObject for this element.

Returns:
the BoxObject for this element

getColorDepth

public int getColorDepth()
Returns the screen's color depth. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the screen's color depth

getConnectionType

public String getConnectionType()
Returns the connection type being used. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the connection type being used Current implementation always return "modem"

getCookieEnabled

public boolean getCookieEnabled()
Returns true if cookies are enabled. Part of the #default#clientCaps default IE behavior implementation.

Returns:
whether or not cookies are enabled

getCpuClass

public String getCpuClass()
Returns the type of CPU used. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the type of CPU used

getHeight

public int getHeight()
Returns the screen's height. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the screen's height

getJavaEnabled

public boolean getJavaEnabled()
Returns true if Java is enabled. Part of the #default#clientCaps default IE behavior implementation.

Returns:
whether or not Java is enabled

getPlatform

public String getPlatform()
Returns the platform used. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the platform used

getSystemLanguage

public String getSystemLanguage()
Returns the system language. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the system language

getUserLanguage

public String getUserLanguage()
Returns the user language. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the user language

getWidth

public int getWidth()
Returns the screen's width. Part of the #default#clientCaps default IE behavior implementation.

Returns:
the screen's width

addComponentRequest

public void addComponentRequest(String id,
                                String idType,
                                String minVersion)
Adds the specified component to the queue of components to be installed. Note that no components ever get installed, and this call is always ignored. Part of the #default#clientCaps default IE behavior implementation.

Parameters:
id - the identifier for the component to install
idType - the type of identifier specified
minVersion - the minimum version of the component to install

clearComponentRequest

public void clearComponentRequest()
Clears the component install queue of all component requests. Note that no components ever get installed, and this call is always ignored. Part of the #default#clientCaps default IE behavior implementation.


compareVersions

public int compareVersions(String v1,
                           String v2)
Compares the two specified version numbers. Part of the #default#clientCaps default IE behavior implementation.

Parameters:
v1 - the first of the two version numbers to compare
v2 - the second of the two version numbers to compare
Returns:
-1 if v1 < v2, 0 if v1 = v2, and 1 if v1 > v2

doComponentRequest

public boolean doComponentRequest()
Downloads all the components queued via addComponentRequest(String, String, String).

Returns:
true if the components are downloaded successfully Current implementation always return false

getComponentVersion

public String getComponentVersion(String id,
                                  String idType)
Returns the version of the specified component.

Parameters:
id - the identifier for the component whose version is to be returned
idType - the type of identifier specified
Returns:
the version of the specified component

isComponentInstalled

public boolean isComponentInstalled(String id,
                                    String idType,
                                    String minVersion)
Returns true if the specified component is installed.

Parameters:
id - the identifier for the component to check for
idType - the type of id specified
minVersion - the minimum version to check for
Returns:
true if the specified component is installed

startDownload

public void startDownload(String uri,
                          net.sourceforge.htmlunit.corejs.javascript.Function callback)
                   throws MalformedURLException
Implementation of the IE behavior #default#download.

Parameters:
uri - the URI of the download source
callback - the method which should be called when the download is finished
Throws:
MalformedURLException - if the URL cannot be created
See Also:
MSDN documentation

isHomePage

public boolean isHomePage(String url)
Returns true if the specified URL is the web client's current homepage and the document calling the method is on the same domain as the user's homepage. Part of the #default#homePage default IE behavior implementation.

Parameters:
url - the URL to check
Returns:
true if the specified URL is the current homepage

setHomePage

public void setHomePage(String url)
Sets the web client's current homepage. Part of the #default#homePage default IE behavior implementation.

Parameters:
url - the new homepage URL

navigateHomePage

public void navigateHomePage()
                      throws IOException
Causes the web client to navigate to the current home page. Part of the #default#homePage default IE behavior implementation.

Throws:
IOException - if loading home page fails

jsxGet_children

public HTMLCollection jsxGet_children()
Gets the children of the current node.

Returns:
the child at the given position
See Also:
MSDN documentation

jsxGet_offsetHeight

public int jsxGet_offsetHeight()
Returns this element's offsetHeight, which is the element height plus the element's padding plus the element's border. This method returns a dummy value compatible with mouse event coordinates during mouse events.

Returns:
this element's offsetHeight
See Also:
MSDN Documentation, Element Dimensions

jsxGet_offsetWidth

public int jsxGet_offsetWidth()
Returns this element's offsetWidth, which is the element width plus the element's padding plus the element's border. This method returns a dummy value compatible with mouse event coordinates during mouse events.

Returns:
this element's offsetWidth
See Also:
MSDN Documentation, Element Dimensions

isAncestorOfEventTarget

protected boolean isAncestorOfEventTarget(MouseEvent event)
Returns true if this element's node is an ancestor of the specified event's target node.

Parameters:
event - the event whose target node is to be checked
Returns:
true if this element's node is an ancestor of the specified event's target node

getPosX

public int getPosX()
Returns this element's X position.

Returns:
this element's X position

getPosY

public int getPosY()
Returns this element's Y position.

Returns:
this element's Y position

jsxGet_offsetLeft

public int jsxGet_offsetLeft()
Returns this element's offsetLeft, which is the calculated left position of this element relative to the offsetParent.

Returns:
this element's offsetLeft
See Also:
MSDN Documentation, Element Dimensions, Reverse Engineering by Anne van Kesteren

jsxGet_offsetTop

public int jsxGet_offsetTop()
Returns this element's offsetTop, which is the calculated top position of this element relative to the offsetParent.

Returns:
this element's offsetTop
See Also:
MSDN Documentation, Element Dimensions, Reverse Engineering by Anne van Kesteren

jsxGet_offsetParent

public Object jsxGet_offsetParent()
Returns this element's offsetParent. The offsetLeft and offsetTop attributes are relative to the offsetParent.

Returns:
this element's offsetParent. This may be undefined when this node is not attached or null for body.
See Also:
MSDN Documentation, Gecko DOM Reference, Element Dimensions, Box Model, Reverse Engineering by Anne van Kesteren

toString

public String toString()

Overrides:
toString in class Object

jsxGet_scrollTop

public int jsxGet_scrollTop()
Gets the scrollTop value for this element.

Returns:
the scrollTop value for this element
See Also:
MSDN documentation

jsxSet_scrollTop

public void jsxSet_scrollTop(int scroll)
Sets the scrollTop value for this element.

Parameters:
scroll - the scrollTop value for this element

jsxGet_scrollLeft

public int jsxGet_scrollLeft()
Gets the scrollLeft value for this element.

Returns:
the scrollLeft value for this element
See Also:
MSDN documentation

jsxSet_scrollLeft

public void jsxSet_scrollLeft(int scroll)
Sets the scrollLeft value for this element.

Parameters:
scroll - the scrollLeft value for this element

jsxGet_scrollHeight

public int jsxGet_scrollHeight()
Gets the scrollHeight for this element.

Returns:
a dummy value of 10
See Also:
MSDN documentation

jsxGet_scrollWidth

public int jsxGet_scrollWidth()
Gets the scrollWidth for this element.

Returns:
a dummy value of 10
See Also:
MSDN documentation

jsxGet_scopeName

public String jsxGet_scopeName()
Gets the namespace defined for the element.

Returns:
the namespace defined for the element
See Also:
MSDN documentation

jsxGet_tagUrn

public String jsxGet_tagUrn()
Gets the Uniform Resource Name (URN) specified in the namespace declaration.

Returns:
the Uniform Resource Name (URN) specified in the namespace declaration
See Also:
MSDN documentation

jsxSet_tagUrn

public void jsxSet_tagUrn(String tagUrn)
Sets the Uniform Resource Name (URN) specified in the namespace declaration.

Parameters:
tagUrn - the Uniform Resource Name (URN) specified in the namespace declaration
See Also:
MSDN documentation

jsxGet_parentElement

public HTMLElement jsxGet_parentElement()
Gets the JavaScript property "parentElement".

Returns:
the parent element
See Also:
Node.jsxGet_parentNode()

getParentHTMLElement

public HTMLElement getParentHTMLElement()
Gets the first ancestor instance of HTMLElement. It is mostly identical to Node.getParent() except that it skips XML nodes.

Returns:
the parent HTML element
See Also:
Node.getParent()

jsxFunction_scrollIntoView

public void jsxFunction_scrollIntoView()
Implement the scrollIntoView() JavaScript function but don't actually do anything. The requirement is just to prevent scripts that call that method from failing


jsxFunction_getBoundingClientRect

public TextRectangle jsxFunction_getBoundingClientRect()
Retrieves an object that specifies the bounds of a collection of TextRectangle objects.

Returns:
an object that specifies the bounds of a collection of TextRectangle objects
See Also:
MSDN doc

jsxFunction_getClientRects

public Object jsxFunction_getClientRects()
Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.

Returns:
a collection of rectangles that describes the layout of the contents

jsxFunction_setExpression

public void jsxFunction_setExpression(String propertyName,
                                      String expression,
                                      String language)
Sets an expression for the specified HTMLElement.

Parameters:
propertyName - Specifies the name of the property to which expression is added
expression - specifies any valid script statement without quotations or semicolons This string can include references to other properties on the current page. Array references are not allowed on object properties included in this script.
language - specified the language used

jsxFunction_removeExpression

public boolean jsxFunction_removeExpression(String propertyName)
Removes the expression from the specified property.

Parameters:
propertyName - Specifies the name of the property from which to remove an expression
Returns:
true if the expression was successfully removed

jsxGet_uniqueID

public String jsxGet_uniqueID()
Retrieves an auto-generated, unique identifier for the object. Note The unique ID generated is not guaranteed to be the same every time the page is loaded.

Returns:
an auto-generated, unique identifier for the object

jsxFunction_dispatchEvent

public boolean jsxFunction_dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only). See the Gecko DOM reference for more information.

Parameters:
event - the event to be dispatched
Returns:
false if at least one of the event handlers which handled the event called preventDefault; true otherwise

getDomNodeOrDie

public final HtmlElement getDomNodeOrDie()
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.

Overrides:
getDomNodeOrDie in class Element
Returns:
the DOM node

getDomNodeOrNull

public HtmlElement getDomNodeOrNull()
Returns the DOM node that corresponds to this JavaScript object or null if a node hasn't been set.

Overrides:
getDomNodeOrNull in class SimpleScriptable
Returns:
the DOM node or null

jsxFunction_blur

public void jsxFunction_blur()
Remove focus from this element.


jsxFunction_createTextRange

public Object jsxFunction_createTextRange()
Creates a new TextRange object for this element.

Returns:
a new TextRange object for this element

jsxFunction_contains

public boolean jsxFunction_contains(HTMLElement element)
Checks whether the given element is contained within this object.

Parameters:
element - element object that specifies the element to check
Returns:
true if the element is contained within this object

jsxFunction_focus

public void jsxFunction_focus()
Sets the focus to this element.


jsxFunction_setActive

public void jsxFunction_setActive()
Sets the object as active without setting focus to the object.

See Also:
MSDN documentation

jsxGet_nodeName

public String jsxGet_nodeName()
Gets the JavaScript property "nodeName" for the current node.

Overrides:
jsxGet_nodeName in class Node
Returns:
the node name

jsxGet_prefix

public String jsxGet_prefix()
Returns the namespace prefix.

Overrides:
jsxGet_prefix in class Node
Returns:
the namespace prefix

jsxGet_filters

public Object jsxGet_filters()
Gets the filters.

Returns:
the filters
See Also:
MSDN doc

jsxFunction_click

public void jsxFunction_click()
                       throws IOException
Click this element. This simulates the action of the user clicking with the mouse.

Throws:
IOException - if this click triggers a page load that encounters problems

jsxGet_spellcheck

public boolean jsxGet_spellcheck()
Returns the "spellcheck" property.

Returns:
the "spellcheck" property

jsxSet_spellcheck

public void jsxSet_spellcheck(boolean spellcheck)
Sets the "spellcheck" property.

Parameters:
spellcheck - the "spellcheck" property

jsxGet_lang

public String jsxGet_lang()
Returns the "lang" property.

Returns:
the "lang" property

jsxSet_lang

public void jsxSet_lang(String lang)
Sets the "lang" property.

Parameters:
lang - the "lang" property

jsxGet_language

public String jsxGet_language()
Returns the "language" property.

Returns:
the "language" property

jsxSet_language

public void jsxSet_language(String language)
Sets the "language" property.

Parameters:
language - the "language" property

jsxGet_dir

public String jsxGet_dir()
Returns the "dir" property.

Returns:
the "dir" property

jsxSet_dir

public void jsxSet_dir(String dir)
Sets the "dir" property.

Parameters:
dir - the "dir" property

jsxGet_tabIndex

public int jsxGet_tabIndex()
Returns the value of the tabIndex attribute.

Returns:
the value of the tabIndex attribute

jsxSet_tabIndex

public void jsxSet_tabIndex(int tabIndex)
Sets the "tabIndex" property.

Parameters:
tabIndex - the "tabIndex" property

jsxFunction_doScroll

public void jsxFunction_doScroll(String scrollAction)
Simulates a click on a scrollbar component (IE only).

Parameters:
scrollAction - the type of scroll action to simulate

jsxGet_accessKey

public String jsxGet_accessKey()
Returns the "accessKey" property.

Returns:
the "accessKey" property

jsxSet_accessKey

public void jsxSet_accessKey(String accessKey)
Sets the "accessKey" property.

Parameters:
accessKey - the "accessKey" property

getWidthOrHeight

protected String getWidthOrHeight(String attributeName,
                                  Boolean returnNegativeValues)
Returns the value of the specified attribute (width or height).

Parameters:
attributeName - the name of the attribute to return ("width" or "height")
returnNegativeValues - if true, negative values are returned; if false, this method returns an empty string in lieu of negative values; if null, this method returns 0 in lieu of negative values
Returns:
the value of the specified attribute (width or height)

setWidthOrHeight

protected void setWidthOrHeight(String attributeName,
                                String value,
                                Boolean allowNegativeValues)
Sets the value of the specified attribute (width or height).

Parameters:
attributeName - the name of the attribute to set ("width" or "height")
value - the value of the specified attribute (width or height)
allowNegativeValues - if true, negative values will be stored; if false, negative values cause an exception to be thrown; if null, negative values set the value to 0

setColorAttribute

protected void setColorAttribute(String name,
                                 String value)
Sets the specified color attribute to the specified value.

Parameters:
name - the color attribute's name
value - the color attribute's value

getAlign

protected String getAlign(boolean returnInvalidValues)
Returns the value of the "align" property.

Parameters:
returnInvalidValues - if true, this method will return any value, including technically invalid values; if false, this method will return an empty string instead of invalid values
Returns:
the value of the "align" property

setAlign

protected void setAlign(String align,
                        boolean ignoreIfNoError)
Sets the value of the "align" property.

Parameters:
align - the value of the "align" property
ignoreIfNoError - if true, the invocation will be a no-op if it does not trigger an error (i.e., it will not actually set the align attribute)

getVAlign

protected String getVAlign(String[] valid,
                           String defaultValue)
Returns the value of the "vAlign" property.

Parameters:
valid - the valid values; if null, any value is valid
defaultValue - the default value to use, if necessary
Returns:
the value of the "vAlign" property

setVAlign

protected void setVAlign(Object vAlign,
                         String[] valid)
Sets the value of the "vAlign" property.

Parameters:
vAlign - the value of the "vAlign" property
valid - the valid values; if null, any value is valid

getCh

protected String getCh()
Returns the value of the "ch" property.

Returns:
the value of the "ch" property

setCh

protected void setCh(String ch)
Sets the value of the "ch" property.

Parameters:
ch - the value of the "ch" property

getChOff

protected String getChOff()
Returns the value of the "chOff" property.

Returns:
the value of the "chOff" property

setChOff

protected void setChOff(String chOff)
Sets the value of the "chOff" property.

Parameters:
chOff - the value of the "chOff" property


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.