|
@@ -24,45 +24,190 @@
|
|
|
|
|
|
package js.html;
|
|
package js.html;
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ 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](https://developer.mozilla.org/en-US/docs/Web/API/Document) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Document$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
|
|
|
+
|
|
|
|
+ @see <https://developer.mozilla.org/en-US/docs/Web/API/Document>
|
|
|
|
+**/
|
|
@:native("Document")
|
|
@:native("Document")
|
|
extern class Document extends Node
|
|
extern class Document extends Node
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the DOM implementation associated with the current document.
|
|
|
|
+ **/
|
|
var implementation(default,null) : DOMImplementation;
|
|
var implementation(default,null) : DOMImplementation;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the document location as a string.
|
|
|
|
+ **/
|
|
var URL(default,null) : String;
|
|
var URL(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the document location as a string.
|
|
|
|
+ **/
|
|
var documentURI(default,null) : String;
|
|
var documentURI(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Indicates whether the document is rendered in quirks or strict mode.
|
|
|
|
+ **/
|
|
var compatMode(default,null) : String;
|
|
var compatMode(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the character set being used by the document.
|
|
|
|
+ **/
|
|
var characterSet(default,null) : String;
|
|
var characterSet(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Alias of `Document.characterSet`. Use this property instead.
|
|
|
|
+ **/
|
|
var charset(default,null) : String;
|
|
var charset(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Alias of `Document.characterSet`. Use this property instead.
|
|
|
|
+ **/
|
|
var inputEncoding(default,null) : String;
|
|
var inputEncoding(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the Content-Type from the MIME Header of the current document.
|
|
|
|
+ **/
|
|
var contentType(default,null) : String;
|
|
var contentType(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the Document Type Definition (DTD) of the current document.
|
|
|
|
+ **/
|
|
var doctype(default,null) : DocumentType;
|
|
var doctype(default,null) : DocumentType;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the `Element` that is a direct child of the document. For HTML documents, this is normally the `html` element.
|
|
|
|
+ **/
|
|
var documentElement(default,null) : Element;
|
|
var documentElement(default,null) : Element;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the URI of the current document.
|
|
|
|
+ **/
|
|
var location(default,null) : Location;
|
|
var location(default,null) : Location;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the URI of the page that linked to this page.
|
|
|
|
+ **/
|
|
var referrer(default,null) : String;
|
|
var referrer(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the date on which the document was last modified.
|
|
|
|
+ **/
|
|
var lastModified(default,null) : String;
|
|
var lastModified(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns loading status of the document.
|
|
|
|
+ **/
|
|
var readyState(default,null) : String;
|
|
var readyState(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Sets or gets title of the current document.
|
|
|
|
+ **/
|
|
var title : String;
|
|
var title : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Gets/sets directionality (rtl/ltr) of the document.
|
|
|
|
+ **/
|
|
var dir : String;
|
|
var dir : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a reference to the window object.
|
|
|
|
+ **/
|
|
var defaultView(default,null) : Window;
|
|
var defaultView(default,null) : Window;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the currently focused element.
|
|
|
|
+ **/
|
|
var activeElement(default,null) : Element;
|
|
var activeElement(default,null) : Element;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `readystatechange` event.
|
|
|
|
+ **/
|
|
var onreadystatechange : haxe.Constraints.Function;
|
|
var onreadystatechange : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `wheel` event.
|
|
|
|
+ **/
|
|
var onwheel : haxe.Constraints.Function;
|
|
var onwheel : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `copy` event.
|
|
|
|
+ **/
|
|
var oncopy : haxe.Constraints.Function;
|
|
var oncopy : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `cut` event.
|
|
|
|
+ **/
|
|
var oncut : haxe.Constraints.Function;
|
|
var oncut : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `paste` event.
|
|
|
|
+ **/
|
|
var onpaste : haxe.Constraints.Function;
|
|
var onpaste : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `beforescriptexecute` event.
|
|
|
|
+ **/
|
|
var onbeforescriptexecute : haxe.Constraints.Function;
|
|
var onbeforescriptexecute : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `afterscriptexecute` event.
|
|
|
|
+ **/
|
|
var onafterscriptexecute : haxe.Constraints.Function;
|
|
var onafterscriptexecute : haxe.Constraints.Function;
|
|
var currentScript(default,null) : Element;
|
|
var currentScript(default,null) : Element;
|
|
var fullscreenEnabled(default,null) : Bool;
|
|
var fullscreenEnabled(default,null) : Bool;
|
|
var fullscreenElement(default,null) : Element;
|
|
var fullscreenElement(default,null) : 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.
|
|
|
|
+ **/
|
|
var pointerLockElement(default,null) : Element;
|
|
var pointerLockElement(default,null) : Element;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ …
|
|
|
|
+ **/
|
|
var hidden(default,null) : Bool;
|
|
var hidden(default,null) : Bool;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+
|
|
|
|
+ Returns a `string` denoting the visibility state of the document. Possible values are `visible`, `hidden`, `prerender`, and `unloaded`.
|
|
|
|
+
|
|
|
|
+ **/
|
|
var visibilityState(default,null) : VisibilityState;
|
|
var visibilityState(default,null) : VisibilityState;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a list of the style sheet objects on the current document.
|
|
|
|
+ **/
|
|
var styleSheets(default,null) : StyleSheetList;
|
|
var styleSheets(default,null) : StyleSheetList;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns which style sheet set is currently in use.
|
|
|
|
+ **/
|
|
var selectedStyleSheetSet : String;
|
|
var selectedStyleSheetSet : 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`.
|
|
|
|
+ **/
|
|
var lastStyleSheetSet(default,null) : String;
|
|
var lastStyleSheetSet(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the preferred style sheet set as specified by the page author.
|
|
|
|
+ **/
|
|
var preferredStyleSheetSet(default,null) : String;
|
|
var preferredStyleSheetSet(default,null) : String;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a list of the style sheet sets available on the document.
|
|
|
|
+ **/
|
|
var styleSheetSets(default,null) : DOMStringList;
|
|
var styleSheetSets(default,null) : DOMStringList;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ …
|
|
|
|
+ **/
|
|
var timeline(default,null) : DocumentTimeline;
|
|
var timeline(default,null) : DocumentTimeline;
|
|
var fonts(default,null) : FontFaceSet;
|
|
var fonts(default,null) : FontFaceSet;
|
|
var onabort : haxe.Constraints.Function;
|
|
var onabort : haxe.Constraints.Function;
|
|
@@ -128,9 +273,25 @@ extern class Document extends Node
|
|
var onpointerleave : haxe.Constraints.Function;
|
|
var onpointerleave : haxe.Constraints.Function;
|
|
var ongotpointercapture : haxe.Constraints.Function;
|
|
var ongotpointercapture : haxe.Constraints.Function;
|
|
var onlostpointercapture : haxe.Constraints.Function;
|
|
var onlostpointercapture : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Is an `EventHandler` representing the code to be called when the `fullscreenchange` event is raised.
|
|
|
|
+ **/
|
|
var onfullscreenchange : haxe.Constraints.Function;
|
|
var onfullscreenchange : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Is an `EventHandler` representing the code to be called when the `fullscreenerror` event is raised.
|
|
|
|
+ **/
|
|
var onfullscreenerror : haxe.Constraints.Function;
|
|
var onfullscreenerror : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represents the event handling code for the `pointerlockchange` event.
|
|
|
|
+ **/
|
|
var onpointerlockchange : haxe.Constraints.Function;
|
|
var onpointerlockchange : haxe.Constraints.Function;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Represetnts the event handling code for the `pointerlockerror` event.
|
|
|
|
+ **/
|
|
var onpointerlockerror : haxe.Constraints.Function;
|
|
var onpointerlockerror : haxe.Constraints.Function;
|
|
var onerror : haxe.Constraints.Function;
|
|
var onerror : haxe.Constraints.Function;
|
|
var children(default,null) : HTMLCollection;
|
|
var children(default,null) : HTMLCollection;
|
|
@@ -144,59 +305,171 @@ extern class Document extends Node
|
|
|
|
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
function new() : Void;
|
|
function new() : Void;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a list of elements with the given tag name.
|
|
|
|
+ **/
|
|
function getElementsByTagName( localName : String ) : HTMLCollection;
|
|
function getElementsByTagName( localName : String ) : HTMLCollection;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a list of elements with the given tag name and namespace.
|
|
|
|
+ **/
|
|
function getElementsByTagNameNS( namespace_ : String, localName : String ) : HTMLCollection;
|
|
function getElementsByTagNameNS( namespace_ : String, localName : String ) : HTMLCollection;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a list of elements with the given class name.
|
|
|
|
+ **/
|
|
function getElementsByClassName( classNames : String ) : HTMLCollection;
|
|
function getElementsByClassName( classNames : String ) : HTMLCollection;
|
|
function getElementById( elementId : String ) : Element;
|
|
function getElementById( elementId : String ) : Element;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
@:overload( function( localName : String ) : Element {} )
|
|
@:overload( function( localName : String ) : Element {} )
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new element with the given tag name.
|
|
|
|
+ **/
|
|
function createElement( localName : String, typeExtension : String ) : Element;
|
|
function createElement( localName : String, typeExtension : String ) : Element;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
@:overload( function( namespace_ : String, qualifiedName : String ) : Element {} )
|
|
@:overload( function( namespace_ : String, qualifiedName : String ) : Element {} )
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new element with the given tag name and namespace URI.
|
|
|
|
+ **/
|
|
function createElementNS( namespace_ : String, qualifiedName : String, typeExtension : String ) : Element;
|
|
function createElementNS( namespace_ : String, qualifiedName : String, typeExtension : String ) : Element;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new document fragment.
|
|
|
|
+ **/
|
|
function createDocumentFragment() : DocumentFragment;
|
|
function createDocumentFragment() : DocumentFragment;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a text node.
|
|
|
|
+ **/
|
|
function createTextNode( data : String ) : Text;
|
|
function createTextNode( data : String ) : Text;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new comment node and returns it.
|
|
|
|
+ **/
|
|
function createComment( data : String ) : Comment;
|
|
function createComment( data : String ) : Comment;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new `ProcessingInstruction` object.
|
|
|
|
+ **/
|
|
function createProcessingInstruction( target : String, data : String ) : ProcessingInstruction;
|
|
function createProcessingInstruction( target : String, data : String ) : ProcessingInstruction;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns a clone of a node from an external document.
|
|
|
|
+ **/
|
|
function importNode( node : Node, ?deep : Bool = false ) : Node;
|
|
function importNode( node : Node, ?deep : Bool = false ) : Node;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Adopt node from an external document.
|
|
|
|
+ **/
|
|
function adoptNode( node : Node ) : Node;
|
|
function adoptNode( node : Node ) : Node;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates an event object.
|
|
|
|
+ **/
|
|
function createEvent( interface_ : String ) : Event;
|
|
function createEvent( interface_ : String ) : Event;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a `Range` object.
|
|
|
|
+ **/
|
|
function createRange() : Range;
|
|
function createRange() : Range;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a `NodeIterator` object.
|
|
|
|
+ **/
|
|
function createNodeIterator( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter ) : NodeIterator;
|
|
function createNodeIterator( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter ) : NodeIterator;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a `TreeWalker` object.
|
|
|
|
+ **/
|
|
function createTreeWalker( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter ) : TreeWalker;
|
|
function createTreeWalker( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter ) : TreeWalker;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new CDATA node and returns it.
|
|
|
|
+ **/
|
|
function createCDATASection( data : String ) : CDATASection;
|
|
function createCDATASection( data : String ) : CDATASection;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new `Attr` object and returns it.
|
|
|
|
+ **/
|
|
function createAttribute( name : String ) : Attr;
|
|
function createAttribute( name : String ) : Attr;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a new attribute node in a given namespace and returns it.
|
|
|
|
+ **/
|
|
function createAttributeNS( namespace_ : String, name : String ) : Attr;
|
|
function createAttributeNS( namespace_ : String, name : String ) : Attr;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
function hasFocus() : Bool;
|
|
function hasFocus() : Bool;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Releases the current mouse capture if it's on an element in this document.
|
|
|
|
+ **/
|
|
function releaseCapture() : Void;
|
|
function releaseCapture() : Void;
|
|
function exitFullscreen() : Void;
|
|
function exitFullscreen() : Void;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Release the pointer lock.
|
|
|
|
+ **/
|
|
function exitPointerLock() : Void;
|
|
function exitPointerLock() : Void;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Registers a web component.
|
|
|
|
+ **/
|
|
function registerElement( name : String, ?options : ElementRegistrationOptions ) : Dynamic;
|
|
function registerElement( name : String, ?options : ElementRegistrationOptions ) : Dynamic;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Enables the style sheets for the specified style sheet set.
|
|
|
|
+ **/
|
|
function enableStyleSheetsForSet( name : String ) : Void;
|
|
function enableStyleSheetsForSet( name : String ) : Void;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns the topmost element at the specified coordinates.
|
|
|
|
+ **/
|
|
function elementFromPoint( x : Float, y : Float ) : Element;
|
|
function elementFromPoint( x : Float, y : Float ) : Element;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns an array of all elements at the specified coordinates.
|
|
|
|
+ **/
|
|
function elementsFromPoint( x : Float, y : Float ) : Array<Element>;
|
|
function elementsFromPoint( x : Float, y : Float ) : Array<Element>;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Gets the `CaretPosition` at or near the specified coordinates.
|
|
|
|
+ **/
|
|
function caretPositionFromPoint( x : Float, y : Float ) : CaretPosition;
|
|
function caretPositionFromPoint( x : Float, y : Float ) : CaretPosition;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
function querySelector( selectors : String ) : Element;
|
|
function querySelector( selectors : String ) : Element;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
function querySelectorAll( selectors : String ) : NodeList;
|
|
function querySelectorAll( selectors : String ) : NodeList;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Returns an array of all `Animation` objects currently in effect whose target elements are descendants of the `document`.
|
|
|
|
+ **/
|
|
function getAnimations() : Array<Animation>;
|
|
function getAnimations() : Array<Animation>;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a `Touch` object.
|
|
|
|
+ **/
|
|
function 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;
|
|
function 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;
|
|
@:overload( function( touch : Touch, touches : haxe.extern.Rest<Touch> ) : TouchList {} )
|
|
@:overload( function( touch : Touch, touches : haxe.extern.Rest<Touch> ) : TouchList {} )
|
|
@:overload( function() : TouchList {} )
|
|
@:overload( function() : TouchList {} )
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ Creates a `TouchList` object.
|
|
|
|
+ **/
|
|
function createTouchList( touches : Array<Touch> ) : TouchList;
|
|
function createTouchList( touches : Array<Touch> ) : TouchList;
|
|
/** @throws DOMError */
|
|
/** @throws DOMError */
|
|
function convertQuadFromNode( quad : DOMQuad, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
|
|
function convertQuadFromNode( quad : DOMQuad, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
|