Document

Document

package js-html

extends NodeEventTarget

extended by Document, HTMLDocument, XMLDocument

Available on js

The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. The DOM tree includes elements such as body and table, among many others. It provides functionality global to the document, like how to obtain the page's URL and create new elements in the document.

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

See:

Constructor

new ()

Throws:

null DOMError

Variables

read only URL:String

Returns the document location as a string.

read only activeElement:Element

Returns the currently focused element.

read only characterSet:String

Returns the character set being used by the document.

read only charset:String

Alias of Document.characterSet. Use this property instead.

read only childElementCount:Int

read only children:HTMLCollection

read only compatMode:String

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

read only contentType:String

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

read only currentScript:Element

read only defaultView:Window

Returns a reference to the window object-

dir:String

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

read only doctype:DocumentType

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

read only documentElement:Element

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

read only documentURI:String

Returns the document location as a string.

read only firstElementChild:Element

read only fonts:FontFaceSet

read only fullscreenElement:Element

read only fullscreenEnabled:Bool

read only hidden:Bool

read only implementation:DOMImplementation

Returns the DOM implementation associated with the current document.

read only inputEncoding:String

Alias of Document.characterSet. Use this property instead.

read only lastElementChild:Element

read only lastModified:String

Returns the date on which the document was last modified.

read only lastStyleSheetSet: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 only location:Location

Returns the URI of the current document.

onabort:Function

onafterscriptexecute:Function

Represents the event handling code for the afterscriptexecute event.

onbeforescriptexecute:Function

Represents the event handling code for the beforescriptexecute event.

onblur:Function

oncanplay:Function

oncanplaythrough:Function

onchange:Function

onclick:Function

oncontextmenu:Function

oncopy:Function

Represents the event handling code for the copy event.

oncut:Function

Represents the event handling code for the cut event.

ondblclick:Function

ondrag:Function

ondragend:Function

ondragenter:Function

ondragleave:Function

ondragover:Function

ondragstart:Function

ondrop:Function

ondurationchange:Function

onemptied:Function

onended:Function

onerror:Function

onfocus:Function

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.

ongotpointercapture:Function

oninput:Function

oninvalid:Function

onkeydown:Function

onkeypress:Function

onkeyup:Function

onload:Function

onloadeddata:Function

onloadedmetadata:Function

onloadstart:Function

onlostpointercapture:Function

onmousedown:Function

onmouseenter:Function

onmouseleave:Function

onmousemove:Function

onmouseout:Function

onmouseover:Function

onmouseup:Function

onpaste:Function

Represents the event handling code for the paste event.

onpause:Function

onplay:Function

onplaying:Function

onpointercancel:Function

onpointerdown:Function

onpointerenter:Function

onpointerleave:Function

onpointerlockchange:Function

Represents the event handling code for the pointerlockchange event.

onpointerlockerror:Function

Represetnts the event handling code for the pointerlockerror event.

onpointermove:Function

onpointerout:Function

onpointerover:Function

onpointerup:Function

onprogress:Function

onratechange:Function

onreadystatechange:Function

Represents the event handling code for the readystatechange event.

onreset:Function

onresize:Function

onscroll:Function

onseeked:Function

onseeking:Function

onselect:Function

onshow:Function

onstalled:Function

onsubmit:Function

onsuspend:Function

ontimeupdate:Function

ontouchcancel:Function

ontouchend:Function

ontouchmove:Function

ontouchstart:Function

onvolumechange:Function

onwaiting:Function

onwheel:Function

Represents the event handling code for the wheel event.

read only pointerLockElement: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 only preferredStyleSheetSet:String

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

read only readyState:String

Returns loading status of the document.

read only referrer:String

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

selectedStyleSheetSet:String

Returns which style sheet set is currently in use.

read only styleSheetSets:DOMStringList

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

read only styleSheets:StyleSheetList

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

read only timeline:DocumentTimeline

title:String

Sets or gets title of the current document.

read only visibilityState:VisibilityState

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

Methods

adoptNode (node:Node):Node

Throws:

null DOMError

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

Gets the CaretPosition at or near the specified coordinates.

convertPointFromNode (point:DOMPointInit, from:EitherType<Text, EitherType<Element, HTMLDocument>>, ?options:ConvertCoordinateOptions):DOMPoint

Throws:

null DOMError

convertQuadFromNode (quad:DOMQuad, from:EitherType<Text, EitherType<Element, HTMLDocument>>, ?options:ConvertCoordinateOptions):DOMQuad

Throws:

null DOMError

convertRectFromNode (rect:DOMRectReadOnly, from:EitherType<Text, EitherType<Element, HTMLDocument>>, ?options:ConvertCoordinateOptions):DOMQuad

Throws:

null DOMError

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

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

Throws:

null DOMError

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

Throws:

null DOMError

createRange ():Range

Throws:

null DOMError

createTextNode (data:String):Text

Creates a text node.

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.

createTouchList (touches:Array<Touch>):TouchList

createTouchList (touch:Touch, touches:Rest<Touch>):TouchList

createTouchList ():TouchList

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

exitFullscreen ():Void

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.

getElementById (elementId:String):Element

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

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.

© 2005–2016 Haxe Foundation
Licensed under a MIT license.
http://api.haxe.org/js/html/Document.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部