com.gargoylesoftware.htmlunit.html
Class HtmlScript

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.DomNode
      extended by com.gargoylesoftware.htmlunit.html.DomNamespaceNode
          extended by com.gargoylesoftware.htmlunit.html.HtmlElement
              extended by com.gargoylesoftware.htmlunit.html.HtmlScript
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class HtmlScript
extends HtmlElement

Wrapper for the html element "script".
When a script tag references an external script (with attribute src) it gets executed when the node is added to the DOM tree. When the script code is nested, it gets executed when the text node containing the script is added to the HtmlScript.
The ScriptFilter feature of NekoHtml can't be used because it doesn't allow immediate access to the DOM (i.e. document.write("<span id='mySpan'/>"); document.getElementById("mySpan").tagName; can't work with a filter).

Version:
$Revision: 1.3 $
Author:
Mike Bowler, Christian Sell, Marc Guillemot, David K. Taylor, Ahmed Ashour, Daniel Gredler
See Also:
DOM Level 1, DOM Level 2, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
HtmlElement.MapEntryWrappingIterator
 
Field Summary
static java.lang.String TAG_NAME
 The HTML tag represented by this element.
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
 
Method Summary
 DomNode appendDomChild(DomNode node)
 Executes the content as a script if said content is a text node.
 java.lang.String asText()
 Returns a text representation of this element that represents what would be visible to the user if this page was shown in a web browser.
 java.lang.String getCharsetAttribute()
 Return the value of the attribute "charset".
 java.lang.String getDeferAttribute()
 Return the value of the attribute "defer".
 java.lang.String getEventAttribute()
 Return the value of the attribute "event".
 java.lang.String getHtmlForAttribute()
 Return the value of the attribute "for".
 java.lang.String getLanguageAttribute()
 Return the value of the attribute "language".
 java.lang.String getSrcAttribute()
 Return the value of the attribute "src".
 java.lang.String getTypeAttribute()
 Return the value of the attribute "type".
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
addHtmlAttributeChangeListener, appendChildIfNoneExists, cloneDomNode, fireEvent, fireEvent, getAttributeEntriesIterator, getAttributeValue, getChildElementsIterator, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getEventHandler, getHtmlElementById, getHtmlElementsByAttribute, getHtmlElementsByTagName, getHtmlElementsByTagNames, getId, getNodeName, getNodeType, getOneHtmlElementByAttribute, getTagName, hasHtmlElementWithId, isAttributeDefined, keyDown, keyDown, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, removeAttribute, removeChild, removeEventHandler, removeHtmlAttributeChangeListener, rightClick, rightClick, setAttributeValue, setEventHandler, setEventHandler, setId, toString
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, asXml, getAllHtmlChildElements, getByXPath, getChildIterator, getEndColumnNumber, getEndLineNumber, getFirstDomChild, getLastDomChild, getNextDomSibling, getNodeValue, getPage, getParentDomNode, getPreviousDomSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, insertBefore, remove, removeAllChildren, removeDomChangeListener, replace, setNodeValue, setReadyState, setScriptObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_NAME

public static final java.lang.String TAG_NAME
The HTML tag represented by this element.

See Also:
Constant Field Values
Method Detail

appendDomChild

public DomNode appendDomChild(DomNode node)
Executes the content as a script if said content is a text node. append a child node to the end of the current list

Overrides:
appendDomChild in class DomNode
Parameters:
node - the node to append
Returns:
the node added

asText

public java.lang.String asText()
Description copied from class: DomNode
Returns a text representation of this element that represents what would be visible to the user if this page was shown in a web browser. For example, a single-selection select element would return the currently selected value as text.

Overrides:
asText in class DomNode
Returns:
an empty string as the content of script is not visible by itself
See Also:
HtmlInput.asText()

getCharsetAttribute

public final java.lang.String getCharsetAttribute()
Return the value of the attribute "charset". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "charset" or an empty string if that attribute isn't defined.

getDeferAttribute

public final java.lang.String getDeferAttribute()
Return the value of the attribute "defer". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "defer" or an empty string if that attribute isn't defined.

getEventAttribute

public final java.lang.String getEventAttribute()
Return the value of the attribute "event".

Returns:
The value of the attribute "event"

getHtmlForAttribute

public final java.lang.String getHtmlForAttribute()
Return the value of the attribute "for".

Returns:
The value of the attribute "for"

getLanguageAttribute

public final java.lang.String getLanguageAttribute()
Return the value of the attribute "language". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "language" or an empty string if that attribute isn't defined.

getSrcAttribute

public final java.lang.String getSrcAttribute()
Return the value of the attribute "src". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "src" or an empty string if that attribute isn't defined.

getTypeAttribute

public final java.lang.String getTypeAttribute()
Return the value of the attribute "type". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "type" or an empty string if that attribute isn't defined.


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.