com.gargoylesoftware.htmlunit.javascript.host.html
Class HTMLDocument

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Node
              extended by com.gargoylesoftware.htmlunit.javascript.host.EventNode
                  extended by com.gargoylesoftware.htmlunit.javascript.host.Document
                      extended by com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument
All Implemented Interfaces:
ScriptableWithFallbackGetter, Serializable, Cloneable, Map, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class HTMLDocument
extends Document
implements ScriptableWithFallbackGetter

A JavaScript object for a Document.

Version:
$Revision: 5893 $
Author:
Mike Bowler, David K. Taylor, Chen Jun, Christian Sell, Chris Erskine, Marc Guillemot, Daniel Gredler, Michael Ottati, George Murnock, Ahmed Ashour, Rob Di Marco, Sudhan Moghe, Mike Dirolf
See Also:
MSDN documentation, W3C DOM Level 1, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static String EMPTY_COOKIE_NAME
          The cookie name used for cookies with no name (HttpClient doesn't like empty names).
 
Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
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
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
HTMLDocument()
          Creates a new instance.
 
Method Summary
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>
N
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".
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Document
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, setWindow
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode
jsxFunction_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_onresize
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
executeEvent, 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_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_nodeValue, jsxSet_textContent, setDomNode, setEventHandler, setEventHandlerProp
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, clear, containsKey, containsValue, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, entrySet, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, keySet, preventExtensions, put, put, put, putAll, putConst, putConstProperty, putProperty, putProperty, redefineProperty, remove, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size, values
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
delete, delete, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

EMPTY_COOKIE_NAME

public static final String EMPTY_COOKIE_NAME
The cookie name used for cookies with no name (HttpClient doesn't like empty names).

See Also:
Constant Field Values
Constructor Detail

HTMLDocument

public HTMLDocument()
Creates a new instance. JavaScript objects must have a default constructor.

Method Detail

getDomNodeOrDie

public <N extends DomNode> N getDomNodeOrDie()
                                  throws IllegalStateException
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.

Overrides:
getDomNodeOrDie in class SimpleScriptable
Type Parameters:
N - the node type
Returns:
the DOM node
Throws:
IllegalStateException - If the DOM node could not be found.

getDomNodeOrNull

public DomNode getDomNodeOrNull()
Returns the DOM node that corresponds to this JavaScript object or null if a node hasn't been set.

Overrides:
getDomNodeOrNull in class SimpleScriptable
Returns:
the DOM node or null

getHtmlPage

public HtmlPage getHtmlPage()
Returns the HTML page that this document is modeling.

Returns:
the HTML page that this document is modeling

getHtmlPageOrNull

public HtmlPage getHtmlPageOrNull()
Returns the HTML page that this document is modeling, or null if the page is empty.

Returns:
the HTML page that this document is modeling, or null if the page is empty

jsxGet_forms

public Object jsxGet_forms()
Returns the value of the JavaScript attribute "forms".

Returns:
the value of the JavaScript attribute "forms"

jsxGet_links

public Object jsxGet_links()
Returns the value of the JavaScript attribute "links". Refer also to the MSDN documentation.

Returns:
the value of this attribute

jsxGet_lastModified

public String jsxGet_lastModified()
Returns the last modification date of the document.

Returns:
the date as string
See Also:
Mozilla documentation

jsxGet_namespaces

public Object jsxGet_namespaces()
Returns the value of the JavaScript attribute "namespaces".

Returns:
the value of the JavaScript attribute "namespaces"

jsxGet_anchors

public Object jsxGet_anchors()
Returns the value of the JavaScript attribute "anchors".

Returns:
the value of this attribute
See Also:
MSDN documentation, Gecko DOM reference

jsxGet_applets

public Object jsxGet_applets()
Returns the value of the JavaScript attribute "applets".

Returns:
the value of this attribute
See Also:
MSDN documentation, Gecko DOM reference

jsxFunction_write

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)
JavaScript function "write" may accept a variable number of arguments. It's not documented by W3C, Mozilla or MSDN but works with Mozilla and IE.

Parameters:
context - the JavaScript context
thisObj - the scriptable
args - the arguments passed into the method
function - the function
See Also:
MSDN documentation

jsxFunction_writeln

public 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. It's not documented by W3C, Mozilla or MSDN but works with Mozilla and IE.

Parameters:
context - the JavaScript context
thisObj - the scriptable
args - the arguments passed into the method
function - the function
See Also:
MSDN documentation

write

protected void write(String content)
JavaScript function "write". 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().

Parameters:
content - the content to write

jsxGet_cookie

public String jsxGet_cookie()
Returns the cookie attribute.

Returns:
the cookie attribute

jsxGet_compatMode

public String jsxGet_compatMode()
Returns the "compatMode" attribute. Note that it is deprecated in Internet Explorer 8 in favor of the documentMode.

Returns:
the "compatMode" attribute

jsxSet_cookie

public void jsxSet_cookie(String newCookie)
Adds a cookie, as long as cookies are enabled.

Parameters:
newCookie - in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure]
See Also:
MSDN documentation

buildCookie

public static Cookie buildCookie(String newCookie,
                                 URL currentURL)
Builds a cookie object from the string representation allowed in JS.

Parameters:
newCookie - in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure]
currentURL - the URL of the current page
Returns:
the cookie

jsxGet_images

public Object jsxGet_images()
Returns the value of the "images" property.

Returns:
the value of the "images" property

jsxGet_URL

public String jsxGet_URL()
Returns the value of the "URL" property.

Returns:
the value of the "URL" property

jsxGet_uniqueID

public String jsxGet_uniqueID()
Retrieves an auto-generated, unique identifier for the object. Note The unique ID generated is not guaranteed to be the same every time the page is loaded.

Returns:
an auto-generated, unique identifier for the object

jsxGet_all

public HTMLCollection jsxGet_all()
Returns the value of the "all" property.

Returns:
the value of the "all" property

jsxFunction_open

public Object jsxFunction_open(String url,
                               Object name,
                               Object features,
                               Object replace)
JavaScript function "open". 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().

Parameters:
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 window
name - the name
features - the features
replace - whether to replace in the history list or no
Returns:
a reference to the new document object or the window object.
See Also:
MSDN documentation

jsxFunction_close

public void jsxFunction_close()
                       throws IOException
JavaScript function "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().

Throws:
IOException - if an IO problem occurs

jsxGet_parentWindow

public Object jsxGet_parentWindow()
Gets the window in which this document is contained.

Returns:
the window

jsxFunction_appendChild

public Object jsxFunction_appendChild(Object childObject)
Adds a DOM node to the node.

Overrides:
jsxFunction_appendChild in class Node
Parameters:
childObject - the node to add to this node
Returns:
the newly added child node

limitAppendChildToIE

protected boolean limitAppendChildToIE()
Returns true if this document only allows appendChild to be called on it when emulating IE.

Returns:
true if this document only allows appendChild to be called on it when emulating IE
See Also:
limitAppendChildToIE(), com.gargoylesoftware.htmlunit.javascript.host.xml.XMLDocument#limitAppendChildToIE()

jsxFunction_createElement

public Object jsxFunction_createElement(String tagName)
Create a new HTML element with the given tag name.

Overrides:
jsxFunction_createElement in class Document
Parameters:
tagName - the tag name
Returns:
the new HTML element, or NOT_FOUND if the tag is not supported

jsxFunction_createStyleSheet

public CSSStyleSheet jsxFunction_createStyleSheet(String url,
                                                  int index)
Creates a new Stylesheet. Current implementation just creates an empty CSSStyleSheet object.

Parameters:
url - the stylesheet URL
index - where to insert the sheet in the collection
Returns:
the newly created stylesheet

jsxFunction_getElementById

public Object jsxFunction_getElementById(String id)
Returns the element with the specified ID, or null if that element could not be found.

Parameters:
id - the ID to search for
Returns:
the element, or null if it could not be found

jsxFunction_getElementsByClassName

public HTMLCollection jsxFunction_getElementsByClassName(String className)
Returns all the descendant elements with the specified class name.

Parameters:
className - the name to search for
Returns:
all the descendant elements with the specified class name
See Also:
Mozilla doc

jsxFunction_getElementsByName

public HTMLCollection jsxFunction_getElementsByName(String elementName)
Returns all HTML elements that have a "name" attribute with the specified value. Refer to The DOM spec for details.

Parameters:
elementName - - value of the "name" attribute to look for
Returns:
all HTML elements that have a "name" attribute with the specified value

getWithPreemption

protected Object getWithPreemption(String name)
Calls to document.XYZ should first look at elements named XYZ before using standard functions.

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!

Overrides:
getWithPreemption in class SimpleScriptable
Parameters:
name - the property name
Returns:
Scriptable.NOT_FOUND if not found

getWithFallback

public Object getWithFallback(String name)
Looks at attributes with the specified name. Fallback called when no configured property is found with the given name on the Scriptable object.

Specified by:
getWithFallback in interface ScriptableWithFallbackGetter
Parameters:
name - the name of the requested property
Returns:
the object value, Scriptable.NOT_FOUND if nothing is found

jsxGet_body

public HTMLElement jsxGet_body()
Returns this document's body element.

Returns:
this document's body element

jsxGet_title

public String jsxGet_title()
Returns this document's title.

Returns:
this document's title

jsxSet_title

public void jsxSet_title(String title)
Sets this document's title.

Parameters:
title - the new title

jsxGet_bgColor

public String jsxGet_bgColor()
Returns the value of the bgColor attribute.

Returns:
the value of the bgColor attribute
See Also:
MSDN Documentation

jsxSet_bgColor

public void jsxSet_bgColor(String bgColor)
Sets the value of the bgColor attribute.

Parameters:
bgColor - the value of the bgColor attribute
See Also:
MSDN Documentation

jsxGet_readyState

public String jsxGet_readyState()
Returns the ready state of the document. This is an IE-only property.

Returns:
the ready state of the document
See Also:
DomNode.READY_STATE_UNINITIALIZED, DomNode.READY_STATE_LOADING, DomNode.READY_STATE_LOADED, DomNode.READY_STATE_INTERACTIVE, DomNode.READY_STATE_COMPLETE

jsxGet_domain

public 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.

Returns:
the domain name of the server that served the document
See Also:
W3C documentation

jsxSet_domain

public void jsxSet_domain(String newDomain)
Sets the the domain of this document. Domains can only be set to suffixes of the existing domain with the exception of setting the domain to itself.

The domain will be set according to the following rules:

  1. If the newDomain.equalsIgnoreCase(currentDomain) the method returns with no error.
  2. If the browser version is netscape, the newDomain is downshifted.
  3. The change will take place if and only if the suffixes of the current domain and the new domain match AND there are at least two domain qualifiers e.g. the following transformations are legal d1.d2.d3.gargoylesoftware.com may be transformed to itself or: d2.d3.gargoylesoftware.com d3.gargoylesoftware.com gargoylesoftware.com transformation to: com will fail

TODO This code could be modified to understand country domain suffixes. The domain www.bbc.co.uk should be trimmable only down to bbc.co.uk trimming to co.uk should not be possible.

Parameters:
newDomain - the new domain to set

jsxGet_scripts

public Object jsxGet_scripts()
Returns the value of the JavaScript attribute scripts.

Returns:
the value of the JavaScript attribute scripts

jsxGet_selection

public Selection jsxGet_selection()
Returns the value of the JavaScript attribute selection.

Returns:
the value of the JavaScript attribute selection

jsxGet_frames

public Object jsxGet_frames()
Returns the value of the frames property.

Returns:
the live collection of frames contained by this document
See Also:
MSDN documentation

jsxGet_styleSheets

public 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.

Returns:
styleSheet collection

jsxFunction_createEvent

public Event jsxFunction_createEvent(String eventType)
                              throws DOMException
Implementation of the DocumentEvent interface's DocumentEvent method. The method creates an uninitialized event of the specified type.

Parameters:
eventType - the event type to create
Returns:
an event object for the specified type
Throws:
DOMException - if the event type is not supported (will have a type of DOMException.NOT_SUPPORTED_ERR)
See Also:
DocumentEvent

jsxFunction_createEventObject

public Event jsxFunction_createEventObject()
Implementation of the createEventObject method supported by Internet Explorer. This method returns an uninitialized event object. It is up to the caller of the method to initialize the properties of the event.

Returns:
an uninitialized event object
See Also:
MSDN Documentation

jsxFunction_elementFromPoint

public Object jsxFunction_elementFromPoint(int x,
                                           int y)
Returns the element for the specified x coordinate and the specified y coordinate. The current implementation always returns the <body> element.

Parameters:
x - the x offset, in pixels
y - the y offset, in pixels
Returns:
the element for the specified x coordinate and the specified y coordinate

jsxFunction_createRange

public Range jsxFunction_createRange()
Creates and returns a new range.

Returns:
a new range
See Also:
XUL Planet

jsxFunction_createTreeWalker

public Object jsxFunction_createTreeWalker(Node root,
                                           int whatToShow,
                                           net.sourceforge.htmlunit.corejs.javascript.Scriptable filter,
                                           boolean expandEntityReferences)
                                    throws DOMException
Creates and returns a new TreeWalker. The following JavaScript parameters are passed into this method:

Parameters:
root - the node which will serve as the root for the TreeWalker
whatToShow - specifies which node types may appear in the logical view of the tree presented
filter - the NodeFilter to be used with this TreeWalker, or null to indicate no filter
expandEntityReferences - If false, the contents of EntityReference nodes are not presented in the logical view
Returns:
a new TreeWalker
Throws:
DOMException - on attempt to create a TreeWalker with a root that is null
See Also:
DOM-Level-2-Traversal-Range

jsxFunction_queryCommandSupported

public boolean jsxFunction_queryCommandSupported(String cmd)
Indicates if the command is supported.

Parameters:
cmd - the command identifier
Returns:
true> if the command is supported
See Also:
MSDN documentation

jsxFunction_queryCommandEnabled

public boolean jsxFunction_queryCommandEnabled(String cmd)
Indicates if the command can be successfully executed using execCommand, given the current state of the document.

Parameters:
cmd - the command identifier
Returns:
true if the command can be successfully executed

jsxFunction_execCommand

public boolean jsxFunction_execCommand(String cmd,
                                       boolean userInterface,
                                       Object value)
Executes a command.

Parameters:
cmd - the command identifier
userInterface - display a user interface if the command supports one
value - the string, number, or other value to assign (possible values depend on the command)
Returns:
true if the command was successful, false otherwise
See Also:
MSDN documentation

jsxGet_activeElement

public Object jsxGet_activeElement()
Returns the value of the "activeElement" property.

Returns:
the value of the "activeElement" property
See Also:
MSDN documentation

setActiveElement

public void setActiveElement(HTMLElement element)
Sets the specified element as the document's active element.

Parameters:
element - the new active element for this document
See Also:
HTMLElement.jsxFunction_setActive()

jsxGet_doctype

public SimpleScriptable jsxGet_doctype()
Gets the JavaScript property "doctype" for the document.

Overrides:
jsxGet_doctype in class Document
Returns:
the DocumentType of the document

jsxFunction_dispatchEvent

public boolean jsxFunction_dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only). See the Gecko DOM reference for more information.

Parameters:
event - the event to be dispatched
Returns:
false if at least one of the event handlers which handled the event called preventDefault; true otherwise

jsxFunction_querySelectorAll

public 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. The NodeList object returned by the querySelectorAll() method must be static, not live.

Parameters:
selectors - the selectors
Returns:
the static node list

jsxFunction_querySelector

public Node jsxFunction_querySelector(String selectors)
Returns the first element within the document that matches the specified group of selectors.

Parameters:
selectors - the selectors
Returns:
null if no matches are found; otherwise, it returns the first matching element

get

public Object get(String name,
                  net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Gets a named property from the object. Normally HtmlUnit objects don't need to overwrite this method as properties are defined on the prototypes from the XML configuration. In some cases where "content" of object has priority compared to the properties consider using utility SimpleScriptable.getWithPreemption(String). For fallback case just implement ScriptableWithFallbackGetter.

Specified by:
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
Overrides:
get in class SimpleScriptable

jsxFunction_clear

public void jsxFunction_clear()
Does... nothing.

See Also:
Mozilla doc


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.