只读activeReturns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document.
For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document.
Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not.
Sets or gets the color of all active links in the document.
只读allReturns a reference to the collection of elements contained by the object.
只读anchorsRetrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.
只读appletsRetrieves a collection of all applet objects in the document.
只读ATTRIBUTE_只读baseURIReturns node's node document's document base URL.
Deprecated. Sets or retrieves a value that indicates the background color behind the object.
Specifies the beginning and end of the document body.
只读CDATA_node is a CDATASection node.
只读characterReturns document's encoding.
只读charsetGets or sets the character set used to encode the object.
只读child只读childReturns the children.
只读childrenReturns the child elements.
只读COMMENT_node is a Comment node.
只读compatGets a value that indicates whether standards-compliant mode is switched on for the object.
只读contentReturns document's content type.
Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned.
Can be set, to add a new cookie to the element's set of HTTP cookies.
If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), a "SecurityError" DOMException will be thrown on getting and setting.
只读currentReturns the script element, or the SVG script element, that is currently executing, as long as the element represents a classic script. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing.
Returns null if the Document is not currently executing a script or SVG script element (e.g., because the running script is an event handler, or a timeout), or if the currently executing script or SVG script element represents a module script.
只读defaultReturns the Window object of the active document.
Sets or gets a value that indicates whether the document can be edited.
Sets or retrieves a value that indicates the reading order of the object.
只读doctypeGets an object representing the document type declaration associated with the current document.
只读DOCUMENT_node is a DocumentFragment node.
只读DOCUMENT_node is a document.
只读DOCUMENT_Set when other is a descendant of node.
只读DOCUMENT_Set when other is an ancestor of node.
只读DOCUMENT_Set when node and other are not in the same tree.
只读DOCUMENT_Set when other is following node.
只读DOCUMENT_只读DOCUMENT_Set when other is preceding node.
只读DOCUMENT_node is a doctype.
只读documentGets a reference to the root node of the document.
只读documentURIReturns document's URL.
Sets or gets the security domain of the document.
只读ELEMENT_node is an element.
只读embedsRetrieves a collection of all embed objects in the document.
只读ENTITY_只读ENTITY_Sets or gets the foreground (text) color of the document.
只读firstReturns the first child.
只读firstReturns the first child that is an element, and null otherwise.
只读fonts只读formsRetrieves a collection, in source order, of all form objects in the document.
只读fullscreen只读fullscreenReturns document's fullscreen element.
只读fullscreenReturns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise.
只读headReturns the head element.
只读hidden只读imagesRetrieves a collection, in source order, of img objects in the document.
只读implementationGets the implementation object of the current document.
只读inputReturns the character encoding used to create the webpage that is loaded into the document object.
只读isReturns true if node is connected and false otherwise.
只读lastReturns the last child.
只读lastReturns the last child that is an element, and null otherwise.
只读lastGets the date that the page was last modified, if the page supplies one.
Sets or gets the color of the document links.
只读linksRetrieves a collection of all a objects that specify the href property and all area objects in the document.
只读nextReturns the next sibling.
只读nodeReturns a string appropriate for the type of node.
只读nodeReturns the type of node.
只读NOTATION_Fires when the user aborts the download.
Fires when the object loses the input focus.
Occurs when playback is possible, but would require further buffering.
Fires when the contents of the object or selection have changed.
Fires when the user clicks the left mouse button on the object
Fires when the user clicks the right mouse button in the client area, opening the context menu.
Fires when the user double-clicks the object.
Fires on the source object continuously during a drag operation.
Fires on the source object when the user releases the mouse at the close of a drag operation.
Fires on the target element when the user drags the object to a valid drop target.
Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.
Fires on the target element continuously while the user drags the object over a valid drop target.
Fires on the source object when the user starts to drag a text selection or selected object.
Occurs when the duration attribute is updated.
Occurs when the media element is reset to its initial state.
Occurs when the end of playback is reached.
Fires when an error occurs during object loading.
Fires when the object receives focus.
Fires when the user presses a key.
Fires when the user presses an alphanumeric key.
Fires when the user releases a key.
Fires immediately after the browser loads the object.
Occurs when media data is loaded at the current playback position.
Occurs when the duration and dimensions of the media have been determined.
Occurs when Internet Explorer begins looking for media data.
Fires when the user clicks the object with either mouse button.
Fires when the user moves the mouse over the object.
Fires when the user moves the mouse pointer outside the boundaries of the object.
Fires when the user moves the mouse pointer into the object.
Fires when the user releases a mouse button while the mouse is over the object.
Occurs when playback is paused.
Occurs when the play method is requested.
Occurs when the audio or video has started playing.
Occurs to indicate progress while downloading media data.
Occurs when the playback rate is increased or decreased.
Fires when the state of the object has changed.
Fires when the user resets a form.
Fires when the user repositions the scroll box in the scroll bar on the object.
Occurs when the seek operation ends.
Occurs when the current playback position is moved.
Fires when the current selection changes.
Occurs when the download has stopped.
Occurs if the load operation has been intentionally halted.
Occurs to indicate the current playback position.
可选ontouchcancel可选ontouchend可选ontouchmove可选ontouchstartOccurs when the volume is changed, or playback is muted or unmuted.
Occurs when playback stops because the next frame of a video resource is not available.
只读ownerReturns the node document. Returns null for documents.
只读parentReturns the parent element.
只读parentReturns the parent.
只读picture只读picture只读pluginsReturn an HTMLCollection of the embed elements in the Document.
只读pointer只读previousReturns the previous sibling.
只读PROCESSING_node is a ProcessingInstruction node.
只读readyRetrieves a value that indicates the current state of the object.
只读referrerGets the URL of the location that referred the user to the current page.
只读root只读scriptsRetrieves a collection of all script objects in the document.
只读scrolling只读styleRetrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.
只读TEXT_node is a Text node.
只读timelineContains the title of the document.
只读URLSets or gets the URL for the current document.
只读visibilitySets or gets the color of the links that the user has visited.
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
可选options: boolean | AddEventListenerOptionsAppends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
可选options: boolean | AddEventListenerOptionsInserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
动态参数...nodes: (string | Node)[]Returns a bitmask indicating the position of other relative to node.
Returns true if other is an inclusive descendant of node, and false otherwise.
Returns a CDATASection node whose data is data.
Creates a new document.
Creates an instance of the element for the specified tag.
The name of an element.
可选options: ElementCreationOptions可选options: ElementCreationOptions可选options: ElementCreationOptionsReturns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName.
If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown.
If one of the following conditions is true a "NamespaceError" DOMException will be thrown:
localName does not match the QName production. Namespace prefix is not null and namespace is the empty string. Namespace prefix is "xml" and namespace is not the XML namespace. qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns".
When supplied, options's is can be used to create a customized built-in element.
可选options: ElementCreationOptions可选options: string | ElementCreationOptions可选resolver: null | XPathNSResolverCreates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
The root element or node to start traversing on.
可选whatToShow: numberThe type of nodes or elements to appear in the node list
可选filter: null | NodeFilterA custom NodeFilter function to use. For more information, see filter. Use null for no filter.
Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown.
Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.
The root element or node to start traversing on.
可选whatToShow: numberThe type of nodes or elements to appear in the node list. For more information, see whatToShow.
可选filter: null | NodeFilterA custom NodeFilter function to use.
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
可选resolver: null | XPathNSResolver可选type: number可选result: null | XPathResultExecutes a command on the current document, current selection, or the given range.
String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
可选showUI: booleanDisplay the user interface, defaults to false.
可选value: stringValue to assign.
Returns a reference to the first object with the specified value of the ID attribute.
String that specifies the ID value.
Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.
Gets a collection of objects based on the value of the NAME or ID attribute.
Gets a collection of objects based on the value of the NAME or ID attribute.
Retrieves a collection of objects based on the specified element name.
If namespace and localName are "*" returns a HTMLCollection of all descendant elements.
If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName.
If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace.
Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName.
Returns node's root.
可选options: GetRootNodeOptionsReturns whether node and otherNode have the same properties.
Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
可选unused1: string可选unused2: stringInserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
动态参数...nodes: (string | Node)[]Returns the first element that is a descendant of node that matches selectors.
Returns all element descendants of node that match selectors.
Removes the event listener in target's event listener list with the same type, callback, and options.
可选options: boolean | EventListenerOptionsRemoves the event listener in target's event listener list with the same type, callback, and options.
可选options: boolean | EventListenerOptionsReplace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
动态参数...nodes: (string | Node)[]
An XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents.