HTMLDocument is an abstract interface of the DOM which provides access to special properties and methods not present by default on a regular (XML) document.

Documentation HTMLDocument by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Variables

Methods

close ():Void

Throws:

null

DOMError

inlinecreateAnchorElement ():AnchorElement

Shorthand for creating an HTML <a> element.

inlinecreateAppletElement ():AppletElement

Shorthand for creating an HTML <applet> element.

inlinecreateAreaElement ():AreaElement

Shorthand for creating an HTML <area> element.

inlinecreateAudioElement ():AudioElement

Shorthand for creating an HTML <audio> element.

inlinecreateBRElement ():BRElement

Shorthand for creating an HTML <br> element.

inlinecreateBaseElement ():BaseElement

Shorthand for creating an HTML <base> element.

inlinecreateBodyElement ():BodyElement

Shorthand for creating an HTML <body> element.

inlinecreateButtonElement ():ButtonElement

Shorthand for creating an HTML <button> element.

inlinecreateCanvasElement ():CanvasElement

Shorthand for creating an HTML <canvas> element.

inlinecreateContentElement ():ContentElement

Shorthand for creating an HTML <content> element.

inlinecreateDListElement ():DListElement

Shorthand for creating an HTML <dl> element.

inlinecreateDataListElement ():DataListElement

Shorthand for creating an HTML <datalist> element.

inlinecreateDirectoryElement ():DirectoryElement

Shorthand for creating an HTML <dir> element.

inlinecreateDivElement ():DivElement

Shorthand for creating an HTML <div> element.

inlinecreateEmbedElement ():EmbedElement

Shorthand for creating an HTML <embed> element.

inlinecreateFieldSetElement ():FieldSetElement

Shorthand for creating an HTML <fieldset> element.

inlinecreateFontElement ():FontElement

Shorthand for creating an HTML <font> element.

inlinecreateFormElement ():FormElement

Shorthand for creating an HTML <form> element.

inlinecreateFrameElement ():FrameElement

Shorthand for creating an HTML <frame> element.

inlinecreateFrameSetElement ():FrameSetElement

Shorthand for creating an HTML <frameset> element.

inlinecreateHRElement ():HRElement

Shorthand for creating an HTML <hr> element.

inlinecreateHeadElement ():HeadElement

Shorthand for creating an HTML <head> element.

inlinecreateHtmlElement ():HtmlElement

Shorthand for creating an HTML <html> element.

inlinecreateIFrameElement ():IFrameElement

Shorthand for creating an HTML <iframe> element.

inlinecreateImageElement ():ImageElement

Shorthand for creating an HTML <img> element.

inlinecreateInputElement ():InputElement

Shorthand for creating an HTML <input> element.

inlinecreateLIElement ():LIElement

Shorthand for creating an HTML <li> element.

inlinecreateLabelElement ():LabelElement

Shorthand for creating an HTML <label> element.

inlinecreateLegendElement ():LegendElement

Shorthand for creating an HTML <legend> element.

inlinecreateLinkElement ():LinkElement

Shorthand for creating an HTML <link> element.

inlinecreateMapElement ():MapElement

Shorthand for creating an HTML <map> element.

inlinecreateMediaElement ():MediaElement

Shorthand for creating an HTML <media> element.

inlinecreateMenuElement ():MenuElement

Shorthand for creating an HTML <menu> element.

inlinecreateMetaElement ():MetaElement

Shorthand for creating an HTML <meta> element.

inlinecreateMeterElement ():MeterElement

Shorthand for creating an HTML <meter> element.

inlinecreateModElement ():ModElement

Shorthand for creating an HTML <mod> element.

inlinecreateOListElement ():OListElement

Shorthand for creating an HTML <ol> element.

inlinecreateObjectElement ():ObjectElement

Shorthand for creating an HTML <object> element.

inlinecreateOptGroupElement ():OptGroupElement

Shorthand for creating an HTML <optgroup> element.

inlinecreateOptionElement ():OptionElement

Shorthand for creating an HTML <option> element.

inlinecreateOutputElement ():OutputElement

Shorthand for creating an HTML <output> element.

inlinecreateParagraphElement ():ParagraphElement

Shorthand for creating an HTML <p> element.

inlinecreateParamElement ():ParamElement

Shorthand for creating an HTML <param> element.

inlinecreatePictureElement ():PictureElement

Shorthand for creating an HTML <picture> element.

inlinecreatePreElement ():PreElement

Shorthand for creating an HTML <pre> element.

inlinecreateProgressElement ():ProgressElement

Shorthand for creating an HTML <progress> element.

inlinecreateQuoteElement ():QuoteElement

Shorthand for creating an HTML <quote> element.

inlinecreateScriptElement ():ScriptElement

Shorthand for creating an HTML <script> element.

inlinecreateSelectElement ():SelectElement

Shorthand for creating an HTML <select> element.

inlinecreateShadowElement ():ShadowElement

Shorthand for creating an HTML <shadow> element.

inlinecreateSourceElement ():SourceElement

Shorthand for creating an HTML <source> element.

inlinecreateSpanElement ():SpanElement

Shorthand for creating an HTML <span> element.

inlinecreateStyleElement ():StyleElement

Shorthand for creating an HTML <style> element.

inlinecreateTableCaptionElement ():TableCaptionElement

Shorthand for creating an HTML <caption> element.

inlinecreateTableCellElement ():TableCellElement

Shorthand for creating an HTML <td> element.

inlinecreateTableColElement ():TableColElement

Shorthand for creating an HTML <col> element.

inlinecreateTableElement ():TableElement

Shorthand for creating an HTML <table> element.

inlinecreateTableRowElement ():TableRowElement

Shorthand for creating an HTML <tr> element.

inlinecreateTableSectionElement ():TableSectionElement

Shorthand for creating an HTML <thead> element.

inlinecreateTextAreaElement ():TextAreaElement

Shorthand for creating an HTML <textarea> element.

inlinecreateTitleElement ():TitleElement

Shorthand for creating an HTML <title> element.

inlinecreateTrackElement ():TrackElement

Shorthand for creating an HTML <track> element.

inlinecreateUListElement ():UListElement

Shorthand for creating an HTML <ul> element.

inlinecreateVideoElement ():VideoElement

Shorthand for creating an HTML <video> element.

@:value({ value : "", showUI : false })execCommand (commandId:String, showUI:Bool = false, value:String = ""):Bool

Throws:

null

DOMError

@:value({ typeNames : "" })getItems (typeNames:String = ""):NodeList

getSelection ():Selection

Throws:

null

DOMError

@:value({ replace : false })open (url:String, name:String, features:String, replace:Bool = false):Window

@:value({ replace : "", type : "text/html" })open (type:String = "text/html", replace:String = ""):HTMLDocument

Throws:

null

DOMError

queryCommandEnabled (commandId:String):Bool

Throws:

null

DOMError

queryCommandIndeterm (commandId:String):Bool

Throws:

null

DOMError

queryCommandState (commandId:String):Bool

Throws:

null

DOMError

queryCommandValue (commandId:String):String

Throws:

null

DOMError

write (text:Rest<String>):Void

Throws:

null

DOMError

writeln (text:Rest<String>):Void

Throws:

null

DOMError

Inherited Variables

Defined by Document

read onlyURL:String

Returns the document location as a string.

read onlyactiveElement:Element

Returns the currently focused element.

read onlycharacterSet:String

Returns the character set being used by the document.

read onlycharset:String

Alias of Document.characterSet. Use this property instead.

read onlycompatMode:String

Indicates whether the document is rendered in quirks or strict mode.

read onlycontentType:String

Returns the Content-Type from the MIME Header of the current document.

read onlydefaultView:Window

Returns a reference to the window object.

dir:String

Gets/sets directionality (rtl/ltr) of the document.

read onlydoctype:DocumentType

Returns the Document Type Definition (DTD) of the current document.

read onlydocumentElement:Element

Returns the Element that is a direct child of the document. For HTML documents, this is normally the html element.

read onlydocumentURI:String

Returns the document location as a string.

read onlyhidden:Bool

read onlyimplementation:DOMImplementation

Returns the DOM implementation associated with the current document.

read onlyinputEncoding:String

Alias of Document.characterSet. Use this property instead.

read onlylastModified:String

Returns the date on which the document was last modified.

read onlylastStyleSheetSet:String

Returns the name of the style sheet set that was last enabled. Has the value null until the style sheet is changed by setting the value of document.selectedStyleSheetSet.

read onlylocation:Location

Returns the URI of the current document.

onafterscriptexecute:Function

Represents the event handling code for the afterscriptexecute event.

onbeforescriptexecute:Function

Represents the event handling code for the beforescriptexecute event.

oncopy:Function

Represents the event handling code for the copy event.

oncut:Function

Represents the event handling code for the cut event.

onfullscreenchange:Function

Is an EventHandler representing the code to be called when the fullscreenchange event is raised.

onfullscreenerror:Function

Is an EventHandler representing the code to be called when the fullscreenerror event is raised.

onpaste:Function

Represents the event handling code for the paste event.

onpointerlockchange:Function

Represents the event handling code for the pointerlockchange event.

onpointerlockerror:Function

Represetnts the event handling code for the pointerlockerror event.

onreadystatechange:Function

Represents the event handling code for the readystatechange event.

onwheel:Function

Represents the event handling code for the wheel event.

read onlypointerLockElement:Element

Returns the element set as the target for mouse events while the pointer is locked. null if lock is pending, pointer is unlocked, or if the target is in another document.

read onlypreferredStyleSheetSet:String

Returns the preferred style sheet set as specified by the page author.

read onlyreadyState:String

Returns loading status of the document.

read onlyreferrer:String

Returns the URI of the page that linked to this page.

selectedStyleSheetSet:String

Returns which style sheet set is currently in use.

read onlystyleSheetSets:DOMStringList

Returns a list of the style sheet sets available on the document.

read onlystyleSheets:StyleSheetList

Returns a list of the style sheet objects on the current document.

title:String

Sets or gets title of the current document.

read onlyvisibilityState:VisibilityState

Returns a string denoting the visibility state of the document. Possible values are visiblehiddenprerender, and unloaded.

Defined by Node

read onlybaseURI:String

Returns a DOMString representing the base URL. The concept of base URL changes from one language to another; in HTML, it corresponds to the protocol, the domain name and the directory structure, that is all until the last '/'.

read onlychildNodes:NodeList

Returns a live NodeList containing all the children of this node. NodeList being live means that if the children of the Node change, the NodeList object is automatically updated.

read onlyfirstChild:Node

Returns a Node representing the first direct child node of the node, or null if the node has no child.

read onlylastChild:Node

Returns a Node representing the last direct child node of the node, or null if the node has no child.

read onlylocalName:String

Returns a DOMString representing the local part of the qualified name of an element.

Note: In Firefox 3.5 and earlier, the property upper-cases the local name for HTML elements (but not XHTML elements). In later versions, this does not happen, so the property is in lower case for both HTML and XHTML. 1.9.2

read onlynamespaceURI:String

The namespace URI of this node, or null if it is no namespace.

Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the https://www.w3.org/1999/xhtml/ namespace in both HTML and XML trees. 1.9.2

read onlynextSibling:Node

Returns a Node representing the next node in the tree, or null if there isn't such node.

read onlynodeName:String

Returns a DOMString containing the name of the Node. The structure of the name will differ with the name type. E.g. An HTMLElement will contain the name of the corresponding tag, like 'audio' for an HTMLAudioElement, a Text node will have the '#text' string, or a Document node will have the '#document' string.

read onlynodeType:Int

Returns an unsigned short representing the type of the node. Possible values are:

Name Value

ELEMENT_NODE 1
ATTRIBUTE_NODE (deprecated) 2
TEXT_NODE 3
CDATA_SECTION_NODE (deprecated) 4
ENTITY_REFERENCE_NODE (deprecated) 5
ENTITY_NODE (deprecated) 6
PROCESSING_INSTRUCTION_NODE 7
COMMENT_NODE 8
DOCUMENT_NODE 9
DOCUMENT_TYPE_NODE 10
DOCUMENT_FRAGMENT_NODE 11
NOTATION_NODE (deprecated) 12

nodeValue:String

Returns / Sets the value of the current node

read onlyownerDocument:HTMLDocument

Returns the Document that this node belongs to. If no document is associated with it, returns null.

read onlyparentElement:Element

Returns an Element that is the parent of this node. If the node has no parent, or if that parent is not an Element, this property returns null.

read onlyparentNode:Node

Returns a Node that is the parent of this node. If there is no such node, like if this node is the top of the tree or if doesn't participate in a tree, this property returns null.

read onlyprefix:String

Is a DOMString representing the namespace prefix of the node, or null if no prefix is specified.

read onlypreviousSibling:Node

Returns a Node representing the previous node in the tree, or null if there isn't such node.

textContent:String

Returns / Sets the textual content of an element and all its descendants.

Inherited Methods

Defined by Document

adoptNode (node:Node):Node

Throws:

null

DOMError

caretPositionFromPoint (x:Float, y:Float):CaretPosition

Gets the CaretPosition at or near the specified coordinates.

createAttribute (name:String):Attr

Throws:

null

DOMError

createAttributeNS (namespace_:String, name:String):Attr

Throws:

null

DOMError

createCDATASection (data:String):CDATASection

Throws:

null

DOMError

createComment (data:String):Comment

Creates a new comment node and returns it.

createDocumentFragment ():DocumentFragment

Creates a new document fragment.

createElement (localName:String, typeExtension:String):Element

createElement (localName:String):Element

Throws:

null

DOMError

createElementNS (namespace_:String, qualifiedName:String, typeExtension:String):Element

createElementNS (namespace_:String, qualifiedName:String):Element

Throws:

null

DOMError

createEvent (interface_:String):Event

Throws:

null

DOMError

createExpression (expression:String, resolver:XPathNSResolver):XPathExpression

Throws:

null

DOMError

createNSResolver (nodeResolver:Node):Node

@:value({ whatToShow : cast 4294967295 })createNodeIterator (root:Node, whatToShow:Int = cast 4294967295, ?filter:NodeFilter):NodeIterator

Throws:

null

DOMError

createRange ():Range

Throws:

null

DOMError

createTextNode (data:String):Text

Creates a text node.

@:value({ force : 0.0, rotationAngle : 0.0, radiusY : 0, radiusX : 0, clientY : 0, clientX : 0, screenY : 0, screenX : 0, pageY : 0, pageX : 0, identifier : 0 })createTouch (?view:Window, ?target:EventTarget, identifier:Int = 0, pageX:Int = 0, pageY:Int = 0, screenX:Int = 0, screenY:Int = 0, clientX:Int = 0, clientY:Int = 0, radiusX:Int = 0, radiusY:Int = 0, rotationAngle:Float = 0.0, force:Float = 0.0):Touch

Creates a Touch object.

@:value({ whatToShow : cast 4294967295 })createTreeWalker (root:Node, whatToShow:Int = cast 4294967295, ?filter:NodeFilter):TreeWalker

Throws:

null

DOMError

elementFromPoint (x:Float, y:Float):Element

Returns the topmost element at the specified coordinates. 

elementsFromPoint (x:Float, y:Float):Array<Element>

Returns an array of all elements at the specified coordinates.

enableStyleSheetsForSet (name:String):Void

Enables the style sheets for the specified style sheet set.

evaluate (expression:String, contextNode:Node, resolver:XPathNSResolver, type:Int, result:Dynamic):XPathResult

Throws:

null

DOMError

exitPointerLock ():Void

Release the pointer lock.

getAnimations ():Array<Animation>

Returns an array of all Animation objects currently in effect whose target elements are descendants of the document.

getElementsByClassName (classNames:String):HTMLCollection

Returns a list of elements with the given class name.

getElementsByTagName (localName:String):HTMLCollection

Returns a list of elements with the given tag name.

getElementsByTagNameNS (namespace_:String, localName:String):HTMLCollection

Throws:

null

DOMError

hasFocus ():Bool

Throws:

null

DOMError

@:value({ deep : false })importNode (node:Node, deep:Bool = false):Node

Throws:

null

DOMError

querySelector (selectors:String):Element

Throws:

null

DOMError

querySelectorAll (selectors:String):NodeList

Throws:

null

DOMError

registerElement (name:String, ?options:ElementRegistrationOptions):Dynamic

Throws:

null

DOMError

releaseCapture ():Void

Releases the current mouse capture if it's on an element in this document.

Defined by Node

appendChild (node:Node):Node

Throws:

null

DOMError

@:value({ deep : false })cloneNode (deep:Bool = false):Node

Throws:

null

DOMError

compareDocumentPosition (other:Node):Int

Returns the context objects root which optionally includes the shadow root if it is available. 

contains (other:Node):Bool

Returns the context objects root which optionally includes the shadow root if it is available. 

hasChildNodes ():Bool

Returns a Boolean indicating if the element has any child nodes, or not.

insertBefore (node:Node, child:Node):Node

Throws:

null

DOMError

isDefaultNamespace (namespace_:String):Bool

Returns a Boolean which indicates whether or not two nodes are of the same type and all their defining data points match.

isEqualNode (node:Node):Bool

Returns a Boolean which indicates whether or not two nodes are of the same type and all their defining data points match.

lookupNamespaceURI (prefix:String):String

Clean up all the text nodes under this element (merge adjacent, remove empty).

lookupPrefix (namespace_:String):String

Clean up all the text nodes under this element (merge adjacent, remove empty).

normalize ():Void

Clean up all the text nodes under this element (merge adjacent, remove empty).

removeChild (child:Node):Node

Throws:

null

DOMError

replaceChild (node:Node, child:Node):Node

Throws:

null

DOMError

Defined by EventTarget

@:value({ capture : false })addEventListener (type:String, listener:Function, capture:Bool = false):Void

@:value({ capture : false })addEventListener (type:String, listener:EventListener, capture:Bool = false, ?wantsUntrusted:Bool):Void

Throws:

null

DOMError

dispatchEvent (event:Event):Bool

Throws:

null

DOMError

@:value({ capture : false })removeEventListener (type:String, listener:Function, capture:Bool = false):Void

@:value({ capture : false })removeEventListener (type:String, listener:EventListener, capture:Bool = false):Void

Throws:

null

DOMError