public class Document extends Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
Constructor and Description |
---|
Document()
Create an instance.
|
Modifier and Type | Method and Description |
---|---|
HtmlPage |
getHtmlPage()
Return the html page that this document is modeling..
|
HtmlPage |
getHtmlPageOrNull()
Return the html page that this document is modeling or null if the
page is empty.
|
protected Object |
getWithPreemption(String name)
Calls to document.XYZ should first look at elements named XYZ before
using standard functions.
|
void |
jsConstructor()
Javascript constructor.
|
void |
jsxFunction_close()
javascript function "close".
|
Attribute |
jsxFunction_createAttribute(String attributeName)
Creates a new HTML attribute with the specified name.
|
Object |
jsxFunction_createDocumentFragment()
Create a new DocumentFragment
|
Object |
jsxFunction_createElement(String tagName)
Create a new HTML element with the given tag name.
|
Object |
jsxFunction_createElementNS(String namespaceURI,
String qualifiedName)
Create a new HTML element with the given tag name, and name
|
Event |
jsxFunction_createEvent(String eventType)
Implementation of the
DocumentEvent interface's
events.DocumentEvent method. |
Event |
jsxFunction_createEventObject()
Implementation of the createEventObject method supported by Internet Explorer.
|
XPathNSResolver |
jsxFunction_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 |
jsxFunction_createRange()
Create a new range.
|
Stylesheet |
jsxFunction_createStyleSheet(String url,
int index)
Creates a new Stylesheet.
|
Object |
jsxFunction_createTextNode(String newData)
Create a new DOM text node with the given data.
|
Object |
jsxFunction_elementFromPoint(int x,
int y)
Returns the element for the specified x coordinate and the specified y coordinate.
|
XPathResult |
jsxFunction_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.
|
BoxObject |
jsxFunction_getBoxObjectFor(HTMLElement element)
Returns the
BoxObject for the specific element. |
Object |
jsxFunction_getElementById(String id)
Return the element with the specified id or null if that element could
not be found
|
Object |
jsxFunction_getElementsByName(String elementName)
Returns all HTML elements that have a "name" attribute with the given value.
|
Object |
jsxFunction_getElementsByTagName(String tagName)
Returns all the descendant elements with the specified tag name.
|
static Object |
jsxFunction_open(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable scriptable,
Object[] args,
org.mozilla.javascript.Function function)
javascript function "open".
|
static void |
jsxFunction_write(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable thisObj,
Object[] args,
org.mozilla.javascript.Function function)
javascript function "write" may accept a variable number of args.
|
static void |
jsxFunction_writeln(org.mozilla.javascript.Context context,
org.mozilla.javascript.Scriptable thisObj,
Object[] args,
org.mozilla.javascript.Function function)
javascript function "writeln" may accept a variable number of args.
|
HTMLCollection |
jsxGet_all()
Return the value of the "all" property.
|
Object |
jsxGet_anchors()
Return the value of the javascript attribute "anchors".
|
Object |
jsxGet_body()
Returns this document's body element.
|
String |
jsxGet_cookie()
Returns the cookie attribute.
|
Object |
jsxGet_defaultView()
Get the window in which this document is contained.
|
SimpleScriptable |
jsxGet_documentElement()
Get the JavaScript property "documentElement" for the document.
|
String |
jsxGet_domain()
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()
Return the value of the javascript attribute "forms".
|
Object |
jsxGet_frames()
Return the value of the frames property.
|
Object |
jsxGet_images()
Return the value of the "images" property.
|
DOMImplementation |
jsxGet_implementation()
Returns the implementation object of the current document.
|
Object |
jsxGet_links()
Return the value of the javascript attribute "links".
|
Location |
jsxGet_location()
Return the value of the "location" property.
|
Object |
jsxGet_parentWindow()
Get the window in which this document is contained.
|
String |
jsxGet_readyState()
Returns the ready state of the document.
|
String |
jsxGet_referrer()
Return the value of the "referrer" property.
|
Object |
jsxGet_scripts()
Return the value of the javascript attribute "scripts".
|
Object |
jsxGet_styleSheets()
Retrieves a collection of styleSheet objects representing the style sheets that correspond
to each instance of a Link or
Style object in the document. |
String |
jsxGet_title()
Returns this document's title.
|
String |
jsxGet_URL()
Return the value of the "URL" property.
|
void |
jsxSet_cookie(String newCookie)
Adds a cookie.
|
void |
jsxSet_domain(String newDomain)
Set the the domain of this document.
|
void |
jsxSet_location(String location)
Sets the value of the "location" property.
|
void |
jsxSet_title(String title)
Sets this document's title.
|
protected void |
write(String content)
javascript function "write".
|
executeEvent, fireEvent, getEventHandler, getEventHandlerProp, getJavaScriptNode, jsxFunction_addEventListener, jsxFunction_appendChild, jsxFunction_attachEvent, jsxFunction_cloneNode, jsxFunction_detachEvent, jsxFunction_hasChildNodes, jsxFunction_insertBefore, jsxFunction_isSameNode, jsxFunction_removeChild, jsxFunction_removeEventListener, jsxFunction_replaceChild, jsxGet_childNodes, jsxGet_firstChild, jsxGet_lastChild, jsxGet_nextSibling, jsxGet_nodeName, jsxGet_nodeType, jsxGet_nodeValue, jsxGet_parentNode, jsxGet_previousSibling, jsxSet_nodeValue, setEventHandler, setEventHandlerProp
get, getBooleanArg, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getIntArg, getLog, getObjectArg, getPrototype, getScriptableFor, getStartingScope, getStringArg, getTransformerScriptableFor, getWindow, getWindow, makeScriptableFor, setDomNode, setDomNode, setHtmlElement
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
public Document()
public void jsConstructor()
public HtmlPage getHtmlPage()
public HtmlPage getHtmlPageOrNull()
public Object jsxGet_forms()
public Object jsxGet_links()
public Object jsxGet_anchors()
public static void jsxFunction_write(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function function)
context
- The javascript contextthisObj
- The scriptableargs
- The arguments passed into the method.function
- The function.public static void jsxFunction_writeln(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function function)
context
- The javascript contextthisObj
- The scriptableargs
- The arguments passed into the method.function
- The function.protected void write(String content)
content
- the content to writepublic String jsxGet_cookie()
public void jsxSet_cookie(String newCookie)
newCookie
- in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure]public Location jsxGet_location()
public void jsxSet_location(String location) throws IOException
location
- the location to navigate toIOException
- when location loading failspublic Object jsxGet_images()
public String jsxGet_referrer()
public String jsxGet_URL()
public HTMLCollection jsxGet_all()
public static Object jsxFunction_open(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scriptable, Object[] args, org.mozilla.javascript.Function function)
context
- The javascript contextscriptable
- The scriptableargs
- The arguments passed into the method.function
- The function.public void jsxFunction_close() throws IOException
IOException
- If an IO problem occurs.public SimpleScriptable jsxGet_documentElement()
public Object jsxGet_defaultView()
public Object jsxGet_parentWindow()
public Object jsxFunction_createElement(String tagName)
tagName
- The tag namepublic Object jsxFunction_createElementNS(String namespaceURI, String qualifiedName)
namespaceURI
- the URI that identifies an XML namespace.qualifiedName
- The qualified name of the element type to instantiatepublic Object jsxFunction_createDocumentFragment()
public Attribute jsxFunction_createAttribute(String attributeName)
attributeName
- the name of the attribute to createpublic Stylesheet jsxFunction_createStyleSheet(String url, int index)
Stylesheet
object.url
- the stylesheet urlindex
- where to insert the sheet in the collectionpublic Object jsxFunction_createTextNode(String newData)
newData
- The string value for the text node.public BoxObject jsxFunction_getBoxObjectFor(HTMLElement element)
BoxObject
for the specific element.element
- target for BoxObject.public Object jsxFunction_getElementById(String id)
id
- The ID to search forpublic Object jsxFunction_getElementsByTagName(String tagName)
tagName
- the name to search forpublic Object 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 SimpleScriptable
name
- the property nameScriptable.NOT_FOUND
if not foundpublic Object jsxGet_body()
public String jsxGet_title()
public void jsxSet_title(String title)
title
- the new titlepublic String jsxGet_readyState()
DomNode.READY_STATE_UNINITIALIZED
,
DomNode.READY_STATE_LOADING
,
DomNode.READY_STATE_LOADED
,
DomNode.READY_STATE_INTERACTIVE
,
DomNode.READY_STATE_COMPLETE
public 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 Object jsxGet_frames()
public DOMImplementation jsxGet_implementation()
public Object jsxGet_styleSheets()
Style
object in the document.public Event jsxFunction_createEvent(String eventType) throws DOMException
DocumentEvent
interface's
events.DocumentEvent
method. The method creates an
event of the specified type.eventType
- The event type to create.DOMException
- Thrown if the event type is not supported. The DOMException will have a
type of DOMException.NOT_SUPPORTED_ERRpublic Event jsxFunction_createEventObject()
public Object jsxFunction_elementFromPoint(int x, int y)
x
- Specifies the X-offset, in pixels.y
- Specifies the Y-offset, in pixels.public Object jsxFunction_createRange()
public XPathNSResolver jsxFunction_createNSResolver(Node nodeResolver)
nodeResolver
- The node to be used as a context for namespace resolution.public XPathResult jsxFunction_evaluate(String expression, Node contextNode, Object resolver, int type, Object result)
expression
- The XPath expression string to be parsed and evaluated.contextNode
- The context node for the evaluation of this XPath expression.resolver
- 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 type.result
- The result object which may be reused and returned by this method.Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.