public class Document extends EventNode
Document
.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 |
---|
Document()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
adoptNode(Node externalNode)
Adopts a node from an external document.
|
void |
captureEvents(String type)
Does nothing special anymore...
|
Attr |
createAttribute(String attributeName)
Creates a new HTML attribute with the specified name.
|
Object |
createComment(String comment)
Creates a new Comment.
|
Object |
createDocumentFragment()
Creates a new document fragment.
|
Object |
createElement(String tagName)
Creates a new element with the given tag name.
|
Object |
createElementNS(String namespaceURI,
String qualifiedName)
Creates a new HTML element with the given tag name, and name.
|
XPathNSResolver |
createNSResolver(Node nodeResolver)
Adapts any DOM node to resolve namespaces so that an XPath expression can be easily
evaluated relative to the context of the node where it appeared within the document.
|
Object |
createTextNode(String newData)
Create a new DOM text node with the given data.
|
XPathResult |
evaluate(String expression,
Node contextNode,
Object resolver,
int type,
Object result)
Evaluates an XPath expression string and returns a result of the specified type if possible.
|
Object |
getDefaultView()
Gets the window in which this document is contained.
|
String |
getDesignMode()
Returns a value which indicates whether or not the document can be edited.
|
SimpleScriptable |
getDoctype()
Gets the JavaScript property
doctype for the document. |
Element |
getDocumentElement()
Gets the JavaScript property
documentElement for the document. |
HTMLCollection |
getElementsByTagName(String tagName)
Returns all the descendant elements with the specified tag name.
|
Object |
getElementsByTagNameNS(Object namespaceURI,
String localName)
Returns a list of elements with the given tag name belonging to the given namespace.
|
DOMImplementation |
getImplementation()
Returns the implementation object of the current document.
|
Location |
getLocation()
Returns the value of the
location property. |
SgmlPage |
getPage()
Returns the page that this document is modeling.
|
String |
getReferrer()
Returns the value of the
referrer property. |
Object |
importNode(Node importedNode,
boolean deep)
Imports a node from another document to this document.
|
void |
setDesignMode(String mode)
Sets a value which indicates whether or not the document can be edited.
|
void |
setLocation(String location)
Sets the value of the
location property. |
void |
setWindow(Window window)
Sets the Window JavaScript object that encloses this document.
|
fireEvent, getOnblur, getOnclick, getOncontextmenu, getOndblclick, getOnerror, getOnfocus, getOnfocusin, getOnfocusout, getOninput, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnpropertychange, getOnresize, setOnblur, setOnclick, setOncontextmenu, setOndblclick, setOnerror, setOnfocus, setOnfocusin, setOnfocusout, setOninput, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnpropertychange, setOnresize
appendChild, asJavaScriptException, cloneNode, compareDocumentPosition, contains, detachEvent, getAttributes, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTextContent, hasChildNodes, insertBefore, insertBeforeImpl, isSameNode, normalize, remove, removeChild, replaceChild, setNodeValue, setTextContent
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventHandlerProp, getEventListenersContainer, hasEventHandlers, removeEventListener, setEventHandler, setEventHandlerProp
clone, equivalentValues, get, getBrowserVersion, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
defineFunctionProperties, defineProperty, getClassName, setClassName, setParentScope
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setPrototype, size
public void setWindow(Window window)
window
- the Window JavaScript object that encloses this documentpublic Location getLocation()
location
property.location
propertypublic void setLocation(String location) throws IOException
location
property. The location's default property is "href",
so setting "document.location='http://www.sf.net'" is equivalent to setting
"document.location.href='http://www.sf.net'".location
- the location to navigate toIOException
- when location loading failspublic String getReferrer()
referrer
property.referrer
propertypublic Element getDocumentElement()
documentElement
for the document.public SimpleScriptable getDoctype()
doctype
for the document.public String getDesignMode()
public void setDesignMode(String mode)
mode
- a value which indicates whether or not the document can be editedpublic SgmlPage getPage()
public Object getDefaultView()
public Object createDocumentFragment()
public Attr createAttribute(String attributeName)
attributeName
- the name of the attribute to createpublic Object importNode(Node importedNode, boolean deep)
importedNode
- the node to importdeep
- Whether to recursively import the subtree under the specified node; or notpublic Object adoptNode(Node externalNode)
externalNode
- the node from another document to be adoptedpublic DOMImplementation getImplementation()
public void captureEvents(String type)
type
- the type of events to captureWindow.captureEvents(String)
public XPathNSResolver createNSResolver(Node nodeResolver)
nodeResolver
- the node to be used as a context for namespace resolutionpublic Object createTextNode(String newData)
newData
- the string value for the text nodepublic Object createComment(String comment)
comment
- the comment textpublic XPathResult evaluate(String expression, Node contextNode, Object resolver, int type, Object result)
expression
- the XPath expression string to be parsed and evaluatedcontextNode
- the context node for the evaluation of this XPath expressionresolver
- the resolver permits translation of all prefixes, including the XML namespace prefix,
within the XPath expression into appropriate namespace URIs.type
- If a specific type is specified, then the result will be returned as the corresponding typeresult
- the result object which may be reused and returned by this methodpublic Object createElement(String tagName)
tagName
- the tag namepublic Object createElementNS(String namespaceURI, String qualifiedName)
namespaceURI
- the URI that identifies an XML namespacequalifiedName
- the qualified name of the element type to instantiatepublic HTMLCollection getElementsByTagName(String tagName)
tagName
- the name to search forpublic Object getElementsByTagNameNS(Object namespaceURI, String localName)
namespaceURI
- the namespace URI of elements to look forlocalName
- is either the local name of elements to look for or the special value "*",
which matches all elements.Copyright © 2002–2019 Gargoyle Software Inc.. All rights reserved.