public class HTMLDocument extends Document
HTMLDocument
.org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
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
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
HTMLDocument() |
Modifier and Type | Method and Description |
---|---|
Object |
appendChild(Object childObject)
Adds a DOM node to the node.
|
void |
close()
JavaScript function
close . |
Attr |
createAttribute(String attributeName)
Creates a new HTML attribute with the specified name.
|
boolean |
dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only).
|
HtmlUnitScriptable |
elementFromPoint(int x,
int y)
Returns the element for the specified x coordinate and the specified y coordinate.
|
HTMLElement |
getActiveElement()
Returns the value of the
activeElement property. |
String |
getBaseURI()
Returns the Base URI as a string.
|
Element |
getDocumentElement()
Gets the JavaScript property
documentElement for the document. |
DomNode |
getDomNodeOrDie()
Returns the DOM node that corresponds to this JavaScript object or throw
an exception if one cannot be found.
|
HtmlUnitScriptable |
getElementById(String id)
Returns the element with the specified ID, or
null if that element could not be found. |
HTMLCollection |
getElementsByClassName(String className)
Returns all the descendant elements with the specified class name.
|
NodeList |
getElementsByName(String elementName)
Returns all HTML elements that have a
name attribute with the specified value. |
HTMLElement |
getHead()
Returns this document's
head element. |
HtmlPage |
getPage()
Returns the HTML page that this document is modeling.
|
Selection |
getSelection()
Returns the current selection.
|
String |
getTitle()
Returns this document's title.
|
protected Object |
getWithPreemption(String name)
Calls to
document.XYZ should first look at elements named XYZ before
using standard functions. |
boolean |
hasFocus()
Returns
false if the active element in the document has no focus;
true if the active element in the document has focus. |
void |
jsConstructor()
JavaScript constructor.
|
Object |
open(Object url,
Object name,
Object features,
Object replace)
JavaScript function "open".
|
void |
setExecutingDynamicExternalPosponed(boolean executing)
This a hack!!!
|
void |
setTitle(String title)
Sets this document's title.
|
static void |
write(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable scope,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
JavaScript function "write" may accept a variable number of arguments.
|
protected void |
write(String content)
JavaScript function "write".
|
static void |
writeln(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable scope,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
JavaScript function "writeln" may accept a variable number of arguments.
|
adoptNode, captureEvents, clear, contains, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEvent, createNodeIterator, createNSResolver, createProcessingInstruction, createRange, createTextNode, createTreeWalker, evaluate, execCommand, forceDocumentMode, generateBlobUrl, getAlinkColor, getAll, getAnchors, getApplets, getBgColor, getBody, getCharacterSet, getCharset, getChildElementCount, getChildren, getCompatMode, getContentType, getCookie, getCurrentScript, getDefaultView, getDesignMode, getDoctype, getDocumentMode, getDocumentURI, getDomain, getElementsByTagName, getElementsByTagNameNS, getEmbeds, getFgColor, getFirstElementChild, getFonts, getForms, getHidden, getImages, getImplementation, getInputEncoding, getLastElementChild, getLastModified, getLinkColor, getLinks, getLocation, getOnabort, getOnafterscriptexecute, getOnauxclick, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnbeforescriptexecute, getOnblur, getOncancel, getOncanplay, getOncanplaythrough, getOnchange, getOnclick, getOnclose, getOncontextmenu, getOncopy, getOncuechange, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOndurationchange, getOnemptied, getOnended, getOnerror, getOnfocus, getOngotpointercapture, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnloadeddata, getOnloadedmetadata, getOnloadstart, getOnlostpointercapture, getOnmousedown, getOnmouseenter, getOnmouseleave, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnmozfullscreenchange, getOnmozfullscreenerror, getOnpaste, getOnpause, getOnplay, getOnplaying, getOnpointercancel, getOnpointerdown, getOnpointerenter, getOnpointerleave, getOnpointerlockchange, getOnpointerlockerror, getOnpointermove, getOnpointerout, getOnpointerover, getOnpointerup, getOnprogress, getOnratechange, getOnreadystatechange, getOnreset, getOnresize, getOnscroll, getOnsearch, getOnseeked, getOnseeking, getOnselect, getOnselectionchange, getOnselectstart, getOnstalled, getOnsubmit, getOnsuspend, getOntimeupdate, getOntoggle, getOnvolumechange, getOnwaiting, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOnwheel, getPlugins, getReadyState, getReferrer, getRootElement, getScripts, getStyleSheets, getURL_js, getVlinkColor, getXmlEncoding, getXmlVersion, importNode, isXmlStandalone, queryCommandEnabled, queryCommandSupported, querySelector, querySelectorAll, releaseCapture, releaseEvents, resolveBlobUrl, revokeBlobUrl, setAlinkColor, setBgColor, setBody, setCookie, setCurrentScript, setDesignMode, setDomain, setFgColor, setLinkColor, setLocation, setOnabort, setOnafterscriptexecute, setOnauxclick, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnbeforescriptexecute, setOnblur, setOncancel, setOncanplay, setOncanplaythrough, setOnchange, setOnclick, setOnclose, setOncontextmenu, setOncopy, setOncuechange, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOndurationchange, setOnemptied, setOnended, setOnerror, setOnfocus, setOngotpointercapture, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnloadeddata, setOnloadedmetadata, setOnloadstart, setOnlostpointercapture, setOnmousedown, setOnmouseenter, setOnmouseleave, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnmozfullscreenchange, setOnmozfullscreenerror, setOnpaste, setOnpause, setOnplay, setOnplaying, setOnpointercancel, setOnpointerdown, setOnpointerenter, setOnpointerleave, setOnpointerlockchange, setOnpointerlockerror, setOnpointermove, setOnpointerout, setOnpointerover, setOnpointerup, setOnprogress, setOnratechange, setOnreadystatechange, setOnreset, setOnresize, setOnscroll, setOnsearch, setOnseeked, setOnseeking, setOnselect, setOnselectionchange, setOnselectstart, setOnstalled, setOnsubmit, setOnsuspend, setOntimeupdate, setOntoggle, setOnvolumechange, setOnwaiting, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOnwheel, setVlinkColor, setWindow
after, append, before, cloneNode, compareDocumentPosition, getAttributes, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, getRootNode, getTextContent, hasAttributes, hasChildNodes, insertBefore, insertBeforeImpl, isEqualNode, isSameNode, lookupPrefix, normalize, prepend, remove, removeChild, replaceChild, replaceChildren, replaceWith, setNodeValue, setTextContent
addEventListener, clearEventListenersContainer, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
public void jsConstructor()
jsConstructor
in class Document
public DomNode getDomNodeOrDie()
getDomNodeOrDie
in class HtmlUnitScriptable
public HtmlPage getPage()
public static void write(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the JavaScript contextscope
- the scopethisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the functionpublic static void writeln(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the JavaScript contextscope
- the scopethisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the functionpublic void setExecutingDynamicExternalPosponed(boolean executing)
executing
- indicates if executing or notprotected void write(String content)
See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for a good description of the semantics of open(), write(), writeln() and close().
content
- the content to writepublic Object open(Object url, Object name, Object features, Object replace)
See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for a good description of the semantics of open(), write(), writeln() and close().
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 close() throws IOException
close
.
See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for a good description of the semantics of open(), write(), writeln() and close().
close
in class Document
IOException
- if an IO problem occurspublic Element getDocumentElement()
documentElement
for the document.getDocumentElement
in class Document
public Object appendChild(Object childObject)
appendChild
in class Node
childObject
- the node to add to this nodepublic HtmlUnitScriptable getElementById(String id)
null
if that element could not be found.getElementById
in class Document
id
- the ID to search fornull
if it could not be foundpublic HTMLCollection getElementsByClassName(String className)
getElementsByClassName
in class Document
className
- the name to search forpublic NodeList getElementsByName(String elementName)
name
attribute with the specified value.
Refer to The DOM spec for details.
getElementsByName
in class Document
elementName
- - value of the name
attribute to look forname
attribute with the specified valueprotected Object getWithPreemption(String name)
document.XYZ
should first look at elements named XYZ
before
using standard functions.
Called by HtmlUnitScriptable.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 HtmlUnitScriptable
name
- the property nameScriptable.NOT_FOUND
if not foundpublic HTMLElement getHead()
head
element.public String getTitle()
public void setTitle(String title)
public HTMLElement getActiveElement()
activeElement
property.getActiveElement
in class Document
activeElement
propertypublic boolean hasFocus()
false
if the active element in the document has no focus;
true
if the active element in the document has focus.public boolean dispatchEvent(Event event)
dispatchEvent
in class EventTarget
event
- the event to be dispatchedfalse
if at least one of the event handlers which handled the event
called preventDefault
; true
otherwisepublic Selection getSelection()
getSelection
in class Document
public Attr createAttribute(String attributeName)
createAttribute
in class Document
attributeName
- the name of the attribute to createpublic String getBaseURI()
getBaseURI
in class Node
public HtmlUnitScriptable elementFromPoint(int x, int y)
elementFromPoint
in class Document
x
- the x offset, in pixelsy
- the y offset, in pixelsCopyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.