JavaScripture
Contribute via GitHub Feedback

JavaScript Document : Node

Instance Properties

URL : String

activeElement : Element

Returns the currently focused element. If there is no focused element, returns this.body. See also hasFocus(), window.onblur, and window.onfocus.

Example:

Run

Results:

 

body : HTMLBodyElement

characterSet : String

compatMode : String

contentType : String

cookie : String

Returns the cookies sent to the server when requesting resources. You can add additional cookies by setting 'key=value' strings to cookie. This will replace any existing value for the specified cookie but will not affect other cookies. You may append additional metadata for the cookie by adding ';metadata-key1=metadata-value1;metadata-key2=metadata-value2;...' to the end of the string when setting the cookie. See Set Cookie Syntax (on page 5) for more details on the supported metadata keys and values.

Example:

Run

Results:

 

doctype : DocumentType  
documentElement : Element  

Usually a HTMLHtmlElement.

documentURI : String

Example:

Run

Results:

 

implementation : DOMImplementation  
readyState : String

Returns 'loading' while this is loading, 'interactive' when this has loaded but not all subresources are loaded, and 'complete' once this and all subresources are loaded.

Example:

Run

Results:

 

styleSheets : StyleSheetList

title : String

Sets the title of the window.

Example:

Run

Results:

 

Instance Methods

adoptNode(source : Node) : Node
append(node0 : Node, [node1 : Node, [...]]) : undefined

createComment(data : String) : Comment
createDocumentFragment() : DocumentFragment
createElement(tagName : String, [typeExtension : String]) : Element
createElementNS(namespaceURI : String, qualifiedName : String, [typeExtension : String]) : Element
createEvent(eventInterfaceName : String) : Event

createNodeIterator(root : Node, [whatToShow : Number, [filter : NodeFilter]]) : NodeIterator

createProcessingInstruction(target : String, data : String) : ProcessingInstruction
createRange() : Range

createTextNode(data : String) : Text
createTreeWalker(root : Node, [whatToShow : Number, [filter : NodeFilter]]) : TreeWalker

getElementById(elementId : String) : Element
getElementsByClassName(classNames : String) : NodeList

getElementsByTagName(tagname : String) : NodeList
getElementsByTagNameNS(namespaceURI : String, localName : String) : NodeList
hasFocus() : Boolean

Returns true if the document has keyboard focus. See also activeElement, window.onblur, and window.onfocus.

Example:

Run

Results:

 

importNode(importedNode : Node, deep : Boolean) : Node
prepend(node0 : Node, [node1 : Node, [...]]) : undefined

querySelector(selectors : String) : Element

Returns the first Element that matches the CSS selector.

Example:

Run

Results:

 

querySelectorAll(cssSelector : String) : NodeList

Returns a NodeList containing the Elements in the document that match the CSS selector.

Example:

Run

Results:

 

registerElement(tagName : String, [options : Object]) : Function
options : {
prototypeCustomElementPrototype
extendsStringThe HTML tagName of the element to is extending
}

Registers a new custom element type for the specified tagName. tagName must have a '-' in it. options.prototype allows you to provide a prototype for the custom elements.

Example:

Run

Results:

 

Instance Events

onabort / 'abort'  
listener(event : Event) : undefined

onload / 'load'  
listener(event : Event) : undefined

onreadystatechange / 'readystatechange'  
listener(event : Event) : undefined