JavaScripture
Contribute via GitHub Feedback

JavaScript Document : Node

Instance Properties

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:

 

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  
documentURI : String

Example:

Run

Results:

 

fullscreenElement : Element  
fullscreenEnabled : Boolean  
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:

 

URL : String

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

exitFullscreen() : undefined
getElementById(elementId : String) : Element

Returns the Element in the document that has Element.id equal to elementId.

Example:

Run

Results:

 

getElementsByClassName(classNames : String) : NodeList

Returns a NodeList containing the Elements in the document where the Element.className matches the specified classNames. classNames can contain multiple classes, separated by spaces, and the returned Elements must contain all the classes. The returned NodeList will update as the document changes.

Example:

Run

Results:

 

getElementsByTagName(tagName : String) : NodeList

Returns a NodeList containing the Elements in the document that have the Element.tagName equal to tagName (case insensitive). The returned NodeList will update as the document changes.

Example:

Run

Results:

 

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. Note that unlike getElementsByClassName() or getElementsByTagName(), the returned NodeList does not update as the document changes.

Example:

Run

Results:

 

Instance Events

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

onfullscreenchange / 'fullscreenchange'  
listener(event : Event) : undefined
onfullscreenerror / 'fullscreenerror'  
listener(event : Event) : undefined
onload / 'load'  
listener(event : Event) : undefined

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

ontouchstart / 'touchstart'  
listener(event : TouchEvent) : undefined

Called when the user begins touching the element.

ontouchend / 'touchend'  
listener(event : TouchEvent) : undefined

Called when the user stops touching the element.

ontouchmove / 'touchmove'  
listener(event : TouchEvent) : undefined

Called when the user moves while touching the element.

ontouchcancel / 'touchcancel'  
listener(event : TouchEvent) : undefined