public class HTMLDocument extends Document implements ScriptableWithFallbackGetter
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_COOKIE_NAME
The cookie name used for cookies with no name (HttpClient doesn't like empty names).
|
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| Constructor and Description |
|---|
HTMLDocument()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
static Cookie |
buildCookie(String newCookie,
URL currentURL)
Builds a cookie object from the string representation allowed in JS.
|
Object |
get(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Gets a named property from the object.
|
<N extends DomNode> |
getDomNodeOrDie()
Returns the DOM node that corresponds to this JavaScript object or throw
an exception if one cannot be found.
|
DomNode |
getDomNodeOrNull()
Returns the DOM node that corresponds to this JavaScript object
or null if a node hasn't been set.
|
HtmlPage |
getHtmlPage()
Returns the HTML page that this document is modeling.
|
HtmlPage |
getHtmlPageOrNull()
Returns the HTML page that this document is modeling, or null if the page is empty.
|
Object |
getWithFallback(String name)
Looks at attributes with the specified name.
|
protected Object |
getWithPreemption(String name)
Calls to document.XYZ should first look at elements named XYZ before
using standard functions.
|
Object |
jsxFunction_appendChild(Object childObject)
Adds a DOM node to the node.
|
void |
jsxFunction_clear()
Does...
|
void |
jsxFunction_close()
JavaScript function "close".
|
Object |
jsxFunction_createElement(String tagName)
Create a new HTML element with the given tag name.
|
Event |
jsxFunction_createEvent(String eventType)
Implementation of the
DocumentEvent interface's
DocumentEvent method. |
Event |
jsxFunction_createEventObject()
Implementation of the createEventObject method supported by Internet Explorer.
|
Range |
jsxFunction_createRange()
Creates and returns a new range.
|
CSSStyleSheet |
jsxFunction_createStyleSheet(String url,
int index)
Creates a new Stylesheet.
|
Object |
jsxFunction_createTreeWalker(Node root,
int whatToShow,
net.sourceforge.htmlunit.corejs.javascript.Scriptable filter,
boolean expandEntityReferences)
Creates and returns a new TreeWalker.
|
boolean |
jsxFunction_dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only).
|
Object |
jsxFunction_elementFromPoint(int x,
int y)
Returns the element for the specified x coordinate and the specified y coordinate.
|
boolean |
jsxFunction_execCommand(String cmd,
boolean userInterface,
Object value)
Executes a command.
|
Object |
jsxFunction_getElementById(String id)
Returns the element with the specified ID, or null if that element could not be found.
|
HTMLCollection |
jsxFunction_getElementsByClassName(String className)
Returns all the descendant elements with the specified class name.
|
HTMLCollection |
jsxFunction_getElementsByName(String elementName)
Returns all HTML elements that have a "name" attribute with the specified value.
|
Object |
jsxFunction_open(String url,
Object name,
Object features,
Object replace)
JavaScript function "open".
|
boolean |
jsxFunction_queryCommandEnabled(String cmd)
Indicates if the command can be successfully executed using execCommand, given
the current state of the document.
|
boolean |
jsxFunction_queryCommandSupported(String cmd)
Indicates if the command is supported.
|
Node |
jsxFunction_querySelector(String selectors)
Returns the first element within the document that matches the specified group of selectors.
|
StaticNodeList |
jsxFunction_querySelectorAll(String selectors)
Retrieves all element nodes from descendants of the starting element node that match any selector
within the supplied selector strings.
|
static void |
jsxFunction_write(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
JavaScript function "write" may accept a variable number of arguments.
|
static void |
jsxFunction_writeln(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
JavaScript function "writeln" may accept a variable number of arguments.
|
Object |
jsxGet_activeElement()
Returns the value of the "activeElement" property.
|
HTMLCollection |
jsxGet_all()
Returns the value of the "all" property.
|
Object |
jsxGet_anchors()
Returns the value of the JavaScript attribute "anchors".
|
Object |
jsxGet_applets()
Returns the value of the JavaScript attribute "applets".
|
String |
jsxGet_bgColor()
Returns the value of the bgColor attribute.
|
HTMLElement |
jsxGet_body()
Returns this document's body element.
|
String |
jsxGet_compatMode()
Returns the "compatMode" attribute.
|
String |
jsxGet_cookie()
Returns the cookie attribute.
|
SimpleScriptable |
jsxGet_doctype()
Gets the JavaScript property "doctype" for the document.
|
String |
jsxGet_domain()
Returns the domain name of the server that served the document, or null if the server
cannot be identified by a domain name.
|
Object |
jsxGet_forms()
Returns the value of the JavaScript attribute "forms".
|
Object |
jsxGet_frames()
Returns the value of the frames property.
|
Object |
jsxGet_images()
Returns the value of the "images" property.
|
String |
jsxGet_lastModified()
Returns the last modification date of the document.
|
Object |
jsxGet_links()
Returns the value of the JavaScript attribute "links".
|
Object |
jsxGet_namespaces()
Returns the value of the JavaScript attribute "namespaces".
|
Object |
jsxGet_parentWindow()
Gets the window in which this document is contained.
|
String |
jsxGet_readyState()
Returns the ready state of the document.
|
Object |
jsxGet_scripts()
Returns the value of the JavaScript attribute scripts.
|
Selection |
jsxGet_selection()
Returns the value of the JavaScript attribute selection.
|
StyleSheetList |
jsxGet_styleSheets()
Retrieves a collection of stylesheet objects representing the style sheets that correspond
to each instance of a Link or
CSSStyleDeclaration object in the document. |
String |
jsxGet_title()
Returns this document's title.
|
String |
jsxGet_uniqueID()
Retrieves an auto-generated, unique identifier for the object.
|
String |
jsxGet_URL()
Returns the value of the "URL" property.
|
void |
jsxSet_bgColor(String bgColor)
Sets the value of the bgColor attribute.
|
void |
jsxSet_cookie(String newCookie)
Adds a cookie, as long as cookies are enabled.
|
void |
jsxSet_domain(String newDomain)
Sets the the domain of this document.
|
void |
jsxSet_title(String title)
Sets this document's title.
|
protected boolean |
limitAppendChildToIE()
Returns true if this document only allows appendChild to be called on
it when emulating IE.
|
void |
setActiveElement(HTMLElement element)
Sets the specified element as the document's active element.
|
protected void |
write(String content)
JavaScript function "write".
|
getPage, jsxFunction_captureEvents, jsxFunction_createAttribute, jsxFunction_createComment, jsxFunction_createDocumentFragment, jsxFunction_createElementNS, jsxFunction_createNSResolver, jsxFunction_createTextNode, jsxFunction_evaluate, jsxFunction_getBoxObjectFor, jsxFunction_getElementsByTagName, jsxFunction_getElementsByTagNameNS, jsxFunction_importNode, jsxGet_defaultView, jsxGet_designMode, jsxGet_documentElement, jsxGet_implementation, jsxGet_location, jsxGet_referrer, jsxSet_designMode, jsxSet_location, setWindowjsxFunction_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_onresizeexecuteEvent, fireEvent, getEventHandler, getEventHandlerProp, getJavaScriptNode, getParent, hasEventHandlers, jsxFunction_addEventListener, 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_innerText, jsxGet_lastChild, jsxGet_localName, jsxGet_namespaceURI, jsxGet_nextSibling, jsxGet_nodeName, jsxGet_nodeType, jsxGet_nodeValue, jsxGet_ownerDocument, jsxGet_parentNode, jsxGet_prefix, jsxGet_previousSibling, jsxGet_textContent, jsxGet_xml, jsxSet_innerText, jsxSet_nodeValue, jsxSet_textContent, setDomNode, setEventHandler, setEventHandlerPropclone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElementapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, 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, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, sizepublic static final String EMPTY_COOKIE_NAME
public HTMLDocument()
public <N extends DomNode> N getDomNodeOrDie() throws IllegalStateException
getDomNodeOrDie in class SimpleScriptableN - the node typeIllegalStateException - If the DOM node could not be found.public DomNode getDomNodeOrNull()
getDomNodeOrNull in class SimpleScriptablepublic HtmlPage getHtmlPage()
public HtmlPage getHtmlPageOrNull()
public Object jsxGet_forms()
public Object jsxGet_links()
public String jsxGet_lastModified()
public Object jsxGet_namespaces()
public Object jsxGet_anchors()
public Object jsxGet_applets()
public static void jsxFunction_write(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
context - the JavaScript contextthisObj - the scriptableargs - the arguments passed into the methodfunction - the functionpublic static void jsxFunction_writeln(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
context - the JavaScript contextthisObj - the scriptableargs - the arguments passed into the methodfunction - the functionprotected void write(String content)
content - the content to writepublic String jsxGet_cookie()
public String jsxGet_compatMode()
public void jsxSet_cookie(String newCookie)
newCookie - in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure]public static Cookie buildCookie(String newCookie, URL currentURL)
newCookie - in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure]currentURL - the URL of the current pagepublic Object jsxGet_images()
public String jsxGet_URL()
public String jsxGet_uniqueID()
public HTMLCollection jsxGet_all()
public Object jsxFunction_open(String url, Object name, Object features, Object replace)
url - when a new document is opened, url is a String that specifies a MIME type for the document.
When a new window is opened, url is a String that specifies the URL to render in the new windowname - the namefeatures - the featuresreplace - whether to replace in the history list or nopublic void jsxFunction_close()
throws IOException
IOException - if an IO problem occurspublic Object jsxGet_parentWindow()
public Object jsxFunction_appendChild(Object childObject)
jsxFunction_appendChild in class NodechildObject - the node to add to this nodeprotected boolean limitAppendChildToIE()
limitAppendChildToIE(),
com.gargoylesoftware.htmlunit.javascript.host.xml.XMLDocument#limitAppendChildToIE()public Object jsxFunction_createElement(String tagName)
jsxFunction_createElement in class DocumenttagName - the tag namepublic CSSStyleSheet jsxFunction_createStyleSheet(String url, int index)
CSSStyleSheet object.url - the stylesheet URLindex - where to insert the sheet in the collectionpublic Object jsxFunction_getElementById(String id)
id - the ID to search forpublic HTMLCollection jsxFunction_getElementsByClassName(String className)
className - the name to search forpublic HTMLCollection jsxFunction_getElementsByName(String elementName)
elementName - - value of the "name" attribute to look forprotected Object getWithPreemption(String name)
Called by SimpleScriptable.get(String, Scriptable) to allow retrieval of the property before the prototype
chain is searched.
IMPORTANT: This method is invoked *very* often by Rhino. If you override this method, the implementation needs to be as fast as possible!
getWithPreemption in class SimpleScriptablename - the property nameScriptable.NOT_FOUND if not foundpublic Object getWithFallback(String name)
Scriptable object.getWithFallback in interface ScriptableWithFallbackGettername - the name of the requested propertyScriptable.NOT_FOUND if nothing is foundpublic HTMLElement jsxGet_body()
public String jsxGet_title()
public void jsxSet_title(String title)
title - the new titlepublic String jsxGet_bgColor()
public void jsxSet_bgColor(String bgColor)
bgColor - the value of the bgColor attributepublic String jsxGet_readyState()
DomNode.READY_STATE_UNINITIALIZED,
DomNode.READY_STATE_LOADING,
DomNode.READY_STATE_LOADED,
DomNode.READY_STATE_INTERACTIVE,
DomNode.READY_STATE_COMPLETEpublic String jsxGet_domain()
public void jsxSet_domain(String newDomain)
The domain will be set according to the following rules:
newDomain - the new domain to setpublic Object jsxGet_scripts()
public Selection jsxGet_selection()
public Object jsxGet_frames()
public StyleSheetList jsxGet_styleSheets()
CSSStyleDeclaration object in the document.public Event jsxFunction_createEvent(String eventType) throws DOMException
DocumentEvent interface's
DocumentEvent method. The method creates an
uninitialized event of the specified type.eventType - the event type to createDOMException - if the event type is not supported (will have a type of
DOMException.NOT_SUPPORTED_ERR)public Event jsxFunction_createEventObject()
public Object jsxFunction_elementFromPoint(int x, int y)
x - the x offset, in pixelsy - the y offset, in pixelspublic Range jsxFunction_createRange()
public Object jsxFunction_createTreeWalker(Node root, int whatToShow, net.sourceforge.htmlunit.corejs.javascript.Scriptable filter, boolean expandEntityReferences) throws DOMException
NodeFilter for the set of possible Show_ values.NodeFilter to be used with this TreeWalker, or null
to indicate no filter.root - the node which will serve as the root for the TreeWalkerwhatToShow - specifies which node types may appear in the logical view of the tree presentedfilter - the NodeFilter to be used with this TreeWalker, or null to indicate no filterexpandEntityReferences - If false,
the contents of EntityReference nodes are not presented in the logical viewDOMException - on attempt to create a TreeWalker with a root that is nullpublic boolean jsxFunction_queryCommandSupported(String cmd)
cmd - the command identifiertrue> if the command is supportedpublic boolean jsxFunction_queryCommandEnabled(String cmd)
cmd - the command identifiertrue if the command can be successfully executedpublic boolean jsxFunction_execCommand(String cmd, boolean userInterface, Object value)
cmd - the command identifieruserInterface - display a user interface if the command supports onevalue - the string, number, or other value to assign (possible values depend on the command)public Object jsxGet_activeElement()
public void setActiveElement(HTMLElement element)
element - the new active element for this documentHTMLElement.jsxFunction_setActive()public SimpleScriptable jsxGet_doctype()
jsxGet_doctype in class Documentpublic boolean jsxFunction_dispatchEvent(Event event)
event - the event to be dispatchedpublic StaticNodeList jsxFunction_querySelectorAll(String selectors)
selectors - the selectorspublic Node jsxFunction_querySelector(String selectors)
selectors - the selectorspublic Object get(String name, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
SimpleScriptable.getWithPreemption(String).
For fallback case just implement ScriptableWithFallbackGetter.
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptableget in class SimpleScriptablepublic void jsxFunction_clear()
Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.