Document interface

该 Document 接口表示浏览器中加载的任何网页,并用作网页内容的入口点,即 DOM 树。

MDN 参考

扩展

Node,DocumentOrShadowRoot,FontFaceSource,GlobalEventHandlers,NonElementParentNode,ParentNode,XPathEvaluatorBase

属性

alinkColor

返回或设置文档正文中活动链接的颜色。

all

Document 接口的只读 all 属性返回一个位于文档节点的 HTMLAllCollection。

anchors

anchors HTMLCollection 的只读属性。

applets

applets Document 的属性返回一个空的 HTMLCollection。

bgColor

已弃用 bgColor 的属性获取或设置当前文档的背景色。

body

该 Document.body 属性表示 null 不存在此类元素。

MDN 参考

characterSet

Document.characterSet只读属性返回当前呈现的文档的字符编码。

MDN 参考

charset
compatMode

Document.compatMode只读属性指示文档是以 Quirks 模式还是标准模式呈现。

MDN 参考

contentType

Document.contentType只读属性返回正在呈现文档的 MIME 类型。

MDN 参考

cookie

使用 Document 属性 cookie 可以读取和写入与文档关联的 Cookie。

MDN 参考

currentScript

该 Document.currentScript 属性返回脚本元素,该脚本当前正在处理,并且不是 JavaScript 模块。

MDN 参考

defaultView

在浏览器中, document.defaultView 返回此属性为只读。

MDN 参考

designMode

document.designMode 控制整个文档是否可编辑。

MDN 参考

dir

该 Document.dir 属性是一个字符串,表示文档文本的方向性,无论是从左到右(默认值)还是从左到左。

MDN 参考

doctype

doctype Document 接口的只读属性是一个 DocumentType 对象,表示与当前文档关联的 Doctype。

MDN 参考

documentElement

documentElement Document 接口的只读属性返回示例 HTML 文档的 html 元素。

MDN 参考

documentURI

documentURI A 字符串的只读属性。

MDN 参考

domain

domain Document 接口的属性获取/设置当前文档的源的域部分,如同源策略使用。

embeds

embeds HTMLCollection 的只读属性。

MDN 参考

fgColor

fgColor 获取/设置当前文档的前景色或文本颜色。

forms

forms Document 接口的只读属性返回一个 HTMLCollection,其中列出了文档中包含的所有窗体元素。

MDN 参考

fragmentDirective

fragmentDirective Document 接口的只读属性返回当前文档的 FragmentDirective。

MDN 参考

fullscreen

过时的文档界面 fullscreen 的只读属性报告文档当前是否在全屏模式下显示内容。

fullscreenEnabled

Document 接口上的只读 fullscreenEnabled 属性指示是否提供全屏模式。

MDN 参考

head

head Document 接口的只读属性返回当前文档的头元素。

MDN 参考

hidden

Document.hidden只读属性返回一个布尔值,该值指示页面是否被视为隐藏。

MDN 参考

images

images Document 接口的只读属性返回当前 HTML 文档中图像的集合。

MDN 参考

implementation

该 Document.implementation 属性返回一个 DOMImplementation 对象。

MDN 参考

inputEncoding
lastModified

lastModified Document 接口的属性返回一个字符串,该字符串包含上次修改当前文档的日期和时间。

MDN 参考

linkColor

该 Document.linkColor 属性获取/设置文档中链接的颜色。

links

links Document 接口的只读属性返回具有 href 属性值的文档中所有区域元素和元素的集合。

MDN 参考

location

Document.location只读属性返回一个并提供用于更改该 URL 并加载另一个 URL 的方法。

MDN 参考

mozCancelFullScreen
msExitFullscreen
onfullscreenchange

MDN 参考

onfullscreenerror

MDN 参考

onpointerlockchange

MDN 参考

onpointerlockerror

MDN 参考

onreadystatechange

MDN 参考

onvisibilitychange

MDN 参考

ownerDocument

Node 接口的只读 ownerDocument 属性返回节点的顶级文档对象。

MDN 参考

pictureInPictureEnabled

可用的只读 pictureInPictureEnabled 属性。

MDN 参考

plugins

plugins包含一个或多个表示 HTMLCollection 的 HTMLEmbedElements 的只读属性。

MDN 参考

readyState

该 Document.readyState 属性描述文档的加载状态。

MDN 参考

referrer

该 Document.referrer 属性返回链接到此页面的页面的 URI。

MDN 参考

rootElement

Document.rootElement 如果文档是文档,则返回作为文档根元素的元素。

scripts

scripts Document 接口的属性返回文档中脚本元素的列表。

MDN 参考

scrollingElement

滚动 scrollingElement 文档的只读属性。

MDN 参考

textContent

MDN 参考

timeline

timeline Document 接口的只读属性表示当前文档的默认时间线。

MDN 参考

title

该 document.title 属性获取或设置文档的当前标题。

MDN 参考

URL

URL Document 接口的只读属性将文档位置作为字符串返回。

MDN 参考

visibilityState

Document.visibilityState只读属性返回文档的可见性。

MDN 参考

vlinkColor

该 Document.vlinkColor 属性获取/设置用户在文档中访问的链接的颜色。

webkitExitFullscreen

继承属性

activeElement

返回文档中最深的元素,其中或要路由到哪些关键事件。 大致而言,这是文档中重点元素。

出于此 API 的目的,当子浏览上下文聚焦时,其容器将集中在父浏览上下文中。 例如,如果用户将焦点移动到 iframe 中的文本控件,则 iframe 是 iframe 节点文档中 activeElement API 返回的元素。

同样,当焦点元素位于与 documentOrShadowRoot 不同的节点树中时,返回的元素将是与 documentOrShadowRoot 位于同一节点树中的主机(如果 documentOrShadowRoot 是包含包含焦点元素的独占上级),如果不是,则返回的元素将为 null。

MDN 参考

adoptedStyleSheets

MDN 参考

ATTRIBUTE_NODE
baseURI

Node 接口的只读 baseURI 属性返回包含节点的文档的绝对基 URL。

MDN 参考

CDATA_SECTION_NODE

节点是 CDATASection 节点。

childElementCount

MDN 参考

childNodes

Node 接口的只读 childNodes 属性返回分配了第一个子节点的实时索引 0。

MDN 参考

children

返回子元素。

MDN 参考

COMMENT_NODE

节点是注释节点。

DOCUMENT_FRAGMENT_NODE

节点是 DocumentFragment 节点。

DOCUMENT_NODE

节点是文档。

DOCUMENT_POSITION_CONTAINED_BY

当其他节点是节点的后代时设置。

DOCUMENT_POSITION_CONTAINS

当其他节点是节点的上级时设置。

DOCUMENT_POSITION_DISCONNECTED

当节点和其他节点不在同一树中时设置。

DOCUMENT_POSITION_FOLLOWING

当其他节点位于以下节点时设置。

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
DOCUMENT_POSITION_PRECEDING

设置其他节点之前的节点。

DOCUMENT_TYPE_NODE

node 是 doctype。

ELEMENT_NODE

node 是一个元素。

ENTITY_NODE
ENTITY_REFERENCE_NODE
firstChild

Node 接口的只读 firstChild 属性返回节点在树中的第一个子级,或者 null 节点没有子级。

MDN 参考

firstElementChild

返回作为元素的第一个子级,否则返回 null。

MDN 参考

fonts

MDN 参考

fullscreenElement

返回文档的全屏元素。

MDN 参考

isConnected

Node 接口的只读 isConnected 属性返回一个布尔值,指示节点是直接还是间接地连接到 Document 对象。

MDN 参考

lastChild

Node 接口的只读 lastChild 属性返回节点的最后一个子级,或者 null 如果没有子节点。

MDN 参考

lastElementChild

返回作为元素的最后一个子级,否则返回 null。

MDN 参考

nextSibling

Node 接口的只读 nextSibling 属性将紧跟在其父节点的 Node.childNodes 中的指定节点之后返回节点,或者如果指定节点是父元素中的最后一个子节点,则返回 null 该节点。

MDN 参考

nodeName

Node 的只读 nodeName 属性将当前节点的名称作为字符串返回。

MDN 参考

nodeType

Node 接口的只读 nodeType 属性是一个整数,用于标识节点是什么。

MDN 参考

nodeValue

nodeValue Node 接口的属性返回或设置当前节点的值。

MDN 参考

NOTATION_NODE
onabort

MDN 参考

onanimationcancel

MDN 参考

onanimationend

MDN 参考

onanimationiteration

MDN 参考

onanimationstart

MDN 参考

onauxclick

MDN 参考

onbeforeinput

MDN 参考

onbeforematch

MDN 参考

onbeforetoggle

MDN 参考

onblur

MDN 参考

oncancel

MDN 参考

oncanplay

MDN 参考

oncanplaythrough

MDN 参考

onchange

MDN 参考

onclick

MDN 参考

onclose

MDN 参考

oncontextlost

MDN 参考

oncontextmenu

MDN 参考

oncontextrestored

MDN 参考

oncopy

MDN 参考

oncuechange

MDN 参考

oncut

MDN 参考

ondblclick

MDN 参考

ondrag

MDN 参考

ondragend

MDN 参考

ondragenter

MDN 参考

ondragleave

MDN 参考

ondragover

MDN 参考

ondragstart

MDN 参考

ondrop

MDN 参考

ondurationchange

MDN 参考

onemptied

MDN 参考

onended

MDN 参考

onerror

MDN 参考

onfocus

MDN 参考

onformdata

MDN 参考

ongotpointercapture

MDN 参考

oninput

MDN 参考

oninvalid

MDN 参考

onkeydown

MDN 参考

onkeypress
onkeyup

MDN 参考

onload

MDN 参考

onloadeddata

MDN 参考

onloadedmetadata

MDN 参考

onloadstart

MDN 参考

onlostpointercapture

MDN 参考

onmousedown

MDN 参考

onmouseenter

MDN 参考

onmouseleave

MDN 参考

onmousemove

MDN 参考

onmouseout

MDN 参考

onmouseover

MDN 参考

onmouseup

MDN 参考

onpaste

MDN 参考

onpause

MDN 参考

onplay

MDN 参考

onplaying

MDN 参考

onpointercancel

MDN 参考

onpointerdown

MDN 参考

onpointerenter

MDN 参考

onpointerleave

MDN 参考

onpointermove

MDN 参考

onpointerout

MDN 参考

onpointerover

MDN 参考

onpointerrawupdate

仅在安全上下文中可用。

MDN 参考

onpointerup

MDN 参考

onprogress

MDN 参考

onratechange

MDN 参考

onreset

MDN 参考

onresize

MDN 参考

onscroll

MDN 参考

onscrollend

MDN 参考

onsecuritypolicyviolation

MDN 参考

onseeked

MDN 参考

onseeking

MDN 参考

onselect

MDN 参考

onselectionchange

MDN 参考

onselectstart

MDN 参考

onslotchange

MDN 参考

onstalled

MDN 参考

onsubmit

MDN 参考

onsuspend

MDN 参考

ontimeupdate

MDN 参考

ontoggle

MDN 参考

ontouchcancel

MDN 参考

ontouchend

MDN 参考

ontouchmove

MDN 参考

ontouchstart

MDN 参考

ontransitioncancel

MDN 参考

ontransitionend

MDN 参考

ontransitionrun

MDN 参考

ontransitionstart

MDN 参考

onvolumechange

MDN 参考

onwaiting

MDN 参考

onwebkitanimationend
onwebkitanimationiteration
onwebkitanimationstart
onwebkittransitionend
onwheel

MDN 参考

parentElement

Node 接口的只读 parentElement 属性返回 DOM 节点的父元素,或者 null 节点没有父元素,或者其父元素不是 DOM 元素。

MDN 参考

parentNode

Node 接口的只读 parentNode 属性返回 DOM 树中指定节点的父级。

MDN 参考

pictureInPictureElement

MDN 参考

pointerLockElement

MDN 参考

previousSibling

Node 接口的只读 previousSibling 属性返回紧邻其父节点中指定节点的前面,或者 null 指定节点是该列表中的第一个节点。

MDN 参考

PROCESSING_INSTRUCTION_NODE

节点是 ProcessingInstruction 节点。

styleSheets

MDN 参考

TEXT_NODE

节点是文本节点。

方法

addEventListener(string, EventListenerOrEventListenerObject, boolean | AddEventListenerOptions)
addEventListener<K>(K, (this: Document, ev: DocumentEventMap[K]) => any, boolean | AddEventListenerOptions)

addEventListener() EventTarget 接口的方法设置一个函数,每当指定事件传递到目标时,就会调用该函数。

MDN 参考

adoptNode<T>(T)

Document.adoptNode() 将节点/dom 从另一个文档传输到方法的文档。

MDN 参考

captureEvents()
caretPositionFromPoint(number, number, CaretPositionFromPointOptions)

caretPositionFromPoint() Document 接口的方法返回一个 CaretPosition 对象,该对象包含 DOM 节点,以及该节点中的插入符号和插入符号的字符偏移量。

MDN 参考

caretRangeFromPoint(number, number)
clear()

该方法 Document.clear() 不执行任何操作,但不引发任何错误。

close()

该方法 Document.close() 完成对文档的写入,使用 Document.open(打开)。

MDN 参考

createAttribute(string)

该方法 Document.createAttribute() 创建新的属性节点,并返回它。

MDN 参考

createAttributeNS(string | null, string)

该方法 Document.createAttributeNS() 创建一个具有指定命名空间 URI 和限定名称的新属性节点,并返回它。

MDN 参考

createCDATASection(string)

createCDATASection() 创建新的 CDATA 节节点,并返回它。

MDN 参考

createComment(string)

createComment() 创建新的注释节点并返回它。

MDN 参考

createDocumentFragment()

创建一个新的空 DocumentFragment,可以将 DOM 节点添加到其中以生成屏幕外 DOM 树。

MDN 参考

createElement(string, ElementCreationOptions)
createElement<K>(K, ElementCreationOptions)

在 HTML 文档中,该方法创建由 localNamedocument.createElement() 指定的 HTML 元素;如果localName无法识别,则创建 HTMLUnknownElement。

MDN 参考

createElement<K>(K, ElementCreationOptions)
createElementNS("http://www.w3.org/1998/Math/MathML", string)
createElementNS("http://www.w3.org/1999/xhtml", string)

创建具有指定命名空间 URI 和限定名称的元素。

MDN 参考

createElementNS("http://www.w3.org/2000/svg", string)
createElementNS(string | null, string, ElementCreationOptions)
createElementNS(string | null, string, string | ElementCreationOptions)
createElementNS<K>("http://www.w3.org/1998/Math/MathML", K)
createElementNS<K>("http://www.w3.org/2000/svg", K)
createEvent("AnimationEvent")

创建指定类型的事件。

createEvent("AnimationPlaybackEvent")
createEvent("AudioProcessingEvent")
createEvent("BeforeUnloadEvent")
createEvent("BlobEvent")
createEvent("ClipboardEvent")
createEvent("CloseEvent")
createEvent("CompositionEvent")
createEvent("ContentVisibilityAutoStateChangeEvent")
createEvent("CookieChangeEvent")
createEvent("CustomEvent")
createEvent("DeviceMotionEvent")
createEvent("DeviceOrientationEvent")
createEvent("DragEvent")
createEvent("ErrorEvent")
createEvent("Event")
createEvent("Events")
createEvent("FocusEvent")
createEvent("FontFaceSetLoadEvent")
createEvent("FormDataEvent")
createEvent("GamepadEvent")
createEvent("HashChangeEvent")
createEvent("IDBVersionChangeEvent")
createEvent("InputEvent")
createEvent("KeyboardEvent")
createEvent("MediaEncryptedEvent")
createEvent("MediaKeyMessageEvent")
createEvent("MediaQueryListEvent")
createEvent("MediaStreamTrackEvent")
createEvent("MessageEvent")
createEvent("MIDIConnectionEvent")
createEvent("MIDIMessageEvent")
createEvent("MouseEvent")
createEvent("MouseEvents")
createEvent("OfflineAudioCompletionEvent")
createEvent("PageRevealEvent")
createEvent("PageSwapEvent")
createEvent("PageTransitionEvent")
createEvent("PaymentMethodChangeEvent")
createEvent("PaymentRequestUpdateEvent")
createEvent("PictureInPictureEvent")
createEvent("PointerEvent")
createEvent("PopStateEvent")
createEvent("ProgressEvent")
createEvent("PromiseRejectionEvent")
createEvent("RTCDataChannelEvent")
createEvent("RTCDTMFToneChangeEvent")
createEvent("RTCErrorEvent")
createEvent("RTCPeerConnectionIceErrorEvent")
createEvent("RTCPeerConnectionIceEvent")
createEvent("RTCTrackEvent")
createEvent("SecurityPolicyViolationEvent")
createEvent("SpeechSynthesisErrorEvent")
createEvent("SpeechSynthesisEvent")
createEvent("StorageEvent")
createEvent("SubmitEvent")
createEvent("TextEvent")
createEvent("ToggleEvent")
createEvent("TouchEvent")
createEvent("TrackEvent")
createEvent("TransitionEvent")
createEvent("UIEvent")
createEvent("UIEvents")
createEvent("WebGLContextEvent")
createEvent("WheelEvent")
createEvent(string)
createNodeIterator(Node, number, NodeFilter | null)

该方法 Document.createNodeIterator() 返回一个新 NodeIterator 对象。

MDN 参考

createProcessingInstruction(string, string)

createProcessingInstruction() 生成新的处理指令节点并返回它。

MDN 参考

createRange()

该方法 Document.createRange() 返回新的 js-nolint createRange() None。

MDN 参考

createTextNode(string)

创建新的“文本”节点。

MDN 参考

createTreeWalker(Node, number, NodeFilter | null)

创建 Document.createTreeWalker() 者方法返回新创建的 TreeWalker 对象。

MDN 参考

execCommand(string, boolean, string)

该方法 execCommand 实现多个不同的命令。

exitFullscreen()

Document 方法 exitFullscreen() 请求此文档中当前以全屏模式呈现的元素已退出全屏模式,从而还原屏幕的上一个状态。

MDN 参考

exitPictureInPicture()

exitPictureInPicture()文档界面的方法要求将当前浮动的本文档中包含的视频从图片中模式中取出,从而还原屏幕的先前状态。

MDN 参考

exitPointerLock()

exitPointerLock() Document 接口的方法以异步方式释放以前通过 Element.requestPointerLock 请求的指针锁。

MDN 参考

getElementById(string)

返回其 ID 为 elementId 的节点后代中的第一个元素。

MDN 参考

getElementsByClassName(string)

getElementsByClassName具有所有给定类名的所有子元素的方法。

MDN 参考

getElementsByName(string)

getElementsByName() Document 对象的方法返回文档中具有给定name属性的元素的 NodeList 集合。

MDN 参考

getElementsByTagName(string)
getElementsByTagName<K>(K)

搜索 getElementsByTagName 完整文档的方法,包括根节点。

MDN 参考

getElementsByTagName<K>(K)
getElementsByTagName<K>(K)
getElementsByTagName<K>(K)
getElementsByTagNameNS("http://www.w3.org/1998/Math/MathML", string)
getElementsByTagNameNS("http://www.w3.org/1999/xhtml", string)

返回一个元素列表,其中包含属于给定命名空间的给定标记名称。

MDN 参考

getElementsByTagNameNS("http://www.w3.org/2000/svg", string)
getElementsByTagNameNS(string | null, string)
getSelection()

getSelection() Document 接口的方法返回与此文档关联的 Selection 对象,表示用户选择的文本范围或插入符号的当前位置。

MDN 参考

hasFocus()

hasFocus() Document 接口的方法返回一个布尔值,该值指示文档内的任何元素是否具有焦点。

MDN 参考

hasStorageAccess()

hasStorageAccess() Document 接口的方法返回一个 Promise,该 Promise 使用布尔值解析,该值指示文档是否有权访问第三方未分区的 Cookie。

MDN 参考

importNode<T>(T, boolean | ImportNodeOptions)

Document 对象 importNode() 的方法会在以后创建插入到当前文档中的副本。

MDN 参考

open(string | URL, string, string)
open(string, string)

此方法 Document.open() 打开一个文档,该文档确实会产生一些副作用。

MDN 参考

queryCommandEnabled(string)

该方法 Document.queryCommandEnabled() 报告是否由浏览器启用指定的编辑器命令。

queryCommandIndeterm(string)
queryCommandState(string)

该方法 queryCommandState() 将告诉你当前所选内容是否应用了特定的 Document.execCommand() 命令。

queryCommandSupported(string)

该方法 Document.queryCommandSupported() 报告浏览器是否支持指定的编辑器命令。

queryCommandValue(string)
releaseEvents()
removeEventListener(string, EventListenerOrEventListenerObject, boolean | EventListenerOptions)
removeEventListener<K>(K, (this: Document, ev: DocumentEventMap[K]) => any, boolean | EventListenerOptions)

removeEventListener() EventTarget 接口的方法从目标中删除以前向 EventTarget.addEventListener() 注册的事件侦听器。

MDN 参考

requestStorageAccess()

requestStorageAccess() Document 接口的方法允许第三方上下文(即嵌入在 iframe 中)中加载的内容请求访问第三方 Cookie 和未分区状态。

MDN 参考

startViewTransition(ViewTransitionUpdateCallback | StartViewTransitionOptions)

startViewTransition() Document 接口的方法启动新的同一文档(SPA)视图转换,并返回一个 ViewTransition 对象来表示它。

MDN 参考

write(string[])

write() Document 接口的方法将一个或多个 TrustedHTML 或字符串参数中的文本写入 document.open 打开的文档流。

writeln(string[])

writeln() Document 接口的方法将一个或多个 TrustedHTML 或字符串参数中的文本写入 document stream,该流由 document.open()打开,后跟换行符。

MDN 参考

继承的方法

append((string | Node)[])

在节点的最后一个子级之后插入节点,同时将节点中的字符串替换为等效的文本节点。

如果违反节点树的约束,则引发“HierarchyRequestError”DOMException。

MDN 参考

appendChild<T>(T)

appendChild() Node 接口的方法将节点添加到指定父节点的子节点列表的末尾。

MDN 参考

cloneNode(boolean)

Node cloneNode() 接口的方法返回调用此方法的节点的副本。

MDN 参考

compareDocumentPosition(Node)

Node compareDocumentPosition() 接口的方法报告其自变量节点相对于调用它的节点的位置。

MDN 参考

contains(Node | null)

contains() Node 接口的方法返回一个布尔值,该值指示节点是否是给定节点的后代,即节点本身、其直接子级之一(Node.childNodes)、子级的直接子级之一等。

MDN 参考

createExpression(string, XPathNSResolver | null)

MDN 参考

createNSResolver(Node)
dispatchEvent(Event)

dispatchEvent() EventTarget 的方法按适当的顺序将事件发送到对象(同步)调用受影响的事件侦听器。

MDN 参考

elementFromPoint(number, number)
elementsFromPoint(number, number)
evaluate(string, Node, XPathNSResolver | null, number, XPathResult | null)

MDN 参考

getAnimations()

MDN 参考

getRootNode(GetRootNodeOptions)

getRootNode() Node 接口的方法返回上下文对象的根,该根(可选)包括影子根(如果可用)。

MDN 参考

hasChildNodes()

Node hasChildNodes() 接口的方法返回一个布尔值,该值指示给定节点是否具有子节点。

MDN 参考

insertBefore<T>(T, Node | null)

Node insertBefore() 接口的方法在 引用节点 之前插入节点作为指定 父节点的子节点。

MDN 参考

isDefaultNamespace(string | null)

isDefaultNamespace() Node 接口的方法接受命名空间 URI 作为参数。

MDN 参考

isEqualNode(Node | null)

isEqualNode() Node 接口的方法测试两个节点是否相等。

MDN 参考

isSameNode(Node | null)

Node isSameNode() 接口的方法是严格相等运算符的 === 旧别名。

MDN 参考

lookupNamespaceURI(string | null)

Node lookupNamespaceURI() 接口的方法采用前缀作为参数,并返回与给定节点上关联的命名空间 URI(如果 null 找不到)。

MDN 参考

lookupPrefix(string | null)

Node lookupPrefix() 接口的方法返回一个字符串,其中包含给定命名空间 URI 的前缀(如果存在)以及 null 不存在的字符串。

MDN 参考

normalize()

Node normalize() 接口的方法将指定节点及其所有子树都放入 规范化 形式。

MDN 参考

prepend((string | Node)[])

在节点的第一个子级之前插入节点,同时将节点中的字符串替换为等效的文本节点。

如果违反节点树的约束,则引发“HierarchyRequestError”DOMException。

MDN 参考

querySelector<E>(string)
querySelector<K>(K)

返回与选择器匹配的节点后代的第一个元素。

MDN 参考

querySelector<K>(K)
querySelector<K>(K)
querySelector<K>(K)
querySelectorAll<E>(string)
querySelectorAll<K>(K)

返回与选择器匹配的节点的所有元素后代。

MDN 参考

querySelectorAll<K>(K)
querySelectorAll<K>(K)
querySelectorAll<K>(K)
removeChild<T>(T)

removeChild() Node 接口的方法从 DOM 中删除子节点,并返回已删除的节点。

MDN 参考

replaceChild<T>(Node, T)

replaceChild() Node 接口的方法替换给定(父)节点中的子节点。

MDN 参考

replaceChildren((string | Node)[])

将节点的所有子级替换为节点,同时将节点中的字符串替换为等效的文本节点。

如果违反节点树的约束,则引发“HierarchyRequestError”DOMException。

MDN 参考

属性详细信息

alinkColor

警告

现已弃用此 API。

MDN Reference

返回或设置文档正文中活动链接的颜色。

alinkColor: string

属性值

string

all

警告

现已弃用此 API。

MDN Reference

Document 接口的只读 all 属性返回一个位于文档节点的 HTMLAllCollection。

all: HTMLAllCollection

属性值

HTMLAllCollection

anchors

警告

现已弃用此 API。

MDN Reference

anchors HTMLCollection 的只读属性。

anchors: HTMLCollectionOf<HTMLAnchorElement>

属性值

HTMLCollectionOf<HTMLAnchorElement>

applets

警告

现已弃用此 API。

MDN Reference

applets Document 的属性返回一个空的 HTMLCollection。

applets: HTMLCollection

属性值

HTMLCollection

bgColor

警告

现已弃用此 API。

MDN Reference

已弃用 bgColor 的属性获取或设置当前文档的背景色。

bgColor: string

属性值

string

body

该 Document.body 属性表示 null 不存在此类元素。

MDN 参考

body: HTMLElement

属性值

HTMLElement

characterSet

Document.characterSet只读属性返回当前呈现的文档的字符编码。

MDN 参考

characterSet: string

属性值

string

charset

警告

现已弃用此 API。

This is a legacy alias of characterSet.

MDN Reference

charset: string

属性值

string

compatMode

Document.compatMode只读属性指示文档是以 Quirks 模式还是标准模式呈现。

MDN 参考

compatMode: string

属性值

string

contentType

Document.contentType只读属性返回正在呈现文档的 MIME 类型。

MDN 参考

contentType: string

属性值

string

使用 Document 属性 cookie 可以读取和写入与文档关联的 Cookie。

MDN 参考

cookie: string

属性值

string

currentScript

该 Document.currentScript 属性返回脚本元素,该脚本当前正在处理,并且不是 JavaScript 模块。

MDN 参考

currentScript: HTMLOrSVGScriptElement | null

属性值

HTMLOrSVGScriptElement | null

defaultView

在浏览器中, document.defaultView 返回此属性为只读。

MDN 参考

defaultView: (Window & typeof globalThis) | null

属性值

(Window & typeof globalThis) | null

designMode

document.designMode 控制整个文档是否可编辑。

MDN 参考

designMode: string

属性值

string

dir

该 Document.dir 属性是一个字符串,表示文档文本的方向性,无论是从左到右(默认值)还是从左到左。

MDN 参考

dir: string

属性值

string

doctype

doctype Document 接口的只读属性是一个 DocumentType 对象,表示与当前文档关联的 Doctype。

MDN 参考

doctype: DocumentType | null

属性值

DocumentType | null

documentElement

documentElement Document 接口的只读属性返回示例 HTML 文档的 html 元素。

MDN 参考

documentElement: HTMLElement

属性值

HTMLElement

documentURI

documentURI A 字符串的只读属性。

MDN 参考

documentURI: string

属性值

string

domain

警告

现已弃用此 API。

MDN Reference

domain Document 接口的属性获取/设置当前文档的源的域部分,如同源策略使用。

domain: string

属性值

string

embeds

embeds HTMLCollection 的只读属性。

MDN 参考

embeds: HTMLCollectionOf<HTMLEmbedElement>

属性值

HTMLCollectionOf<HTMLEmbedElement>

fgColor

警告

现已弃用此 API。

MDN Reference

fgColor 获取/设置当前文档的前景色或文本颜色。

fgColor: string

属性值

string

forms

forms Document 接口的只读属性返回一个 HTMLCollection,其中列出了文档中包含的所有窗体元素。

MDN 参考

forms: HTMLCollectionOf<HTMLFormElement>

属性值

HTMLCollectionOf<HTMLFormElement>

fragmentDirective

fragmentDirective Document 接口的只读属性返回当前文档的 FragmentDirective。

MDN 参考

fragmentDirective: FragmentDirective

属性值

FragmentDirective

fullscreen

警告

现已弃用此 API。

MDN Reference

过时的文档界面 fullscreen 的只读属性报告文档当前是否在全屏模式下显示内容。

fullscreen: boolean

属性值

boolean

fullscreenEnabled

Document 接口上的只读 fullscreenEnabled 属性指示是否提供全屏模式。

MDN 参考

fullscreenEnabled: boolean

属性值

boolean

head

head Document 接口的只读属性返回当前文档的头元素。

MDN 参考

head: HTMLHeadElement

属性值

HTMLHeadElement

hidden

Document.hidden只读属性返回一个布尔值,该值指示页面是否被视为隐藏。

MDN 参考

hidden: boolean

属性值

boolean

images

images Document 接口的只读属性返回当前 HTML 文档中图像的集合。

MDN 参考

images: HTMLCollectionOf<HTMLImageElement>

属性值

HTMLCollectionOf<HTMLImageElement>

implementation

该 Document.implementation 属性返回一个 DOMImplementation 对象。

MDN 参考

implementation: DOMImplementation

属性值

DOMImplementation

inputEncoding

警告

现已弃用此 API。

This is a legacy alias of characterSet.

MDN Reference

inputEncoding: string

属性值

string

lastModified

lastModified Document 接口的属性返回一个字符串,该字符串包含上次修改当前文档的日期和时间。

MDN 参考

lastModified: string

属性值

string

linkColor

警告

现已弃用此 API。

MDN Reference

该 Document.linkColor 属性获取/设置文档中链接的颜色。

linkColor: string

属性值

string

links Document 接口的只读属性返回具有 href 属性值的文档中所有区域元素和元素的集合。

MDN 参考

links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>

属性值

HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>

location

Document.location只读属性返回一个并提供用于更改该 URL 并加载另一个 URL 的方法。

MDN 参考

Location location

属性值

Location

mozCancelFullScreen

mozCancelFullScreen: any

属性值

any

msExitFullscreen

msExitFullscreen: any

属性值

any

onfullscreenchange

MDN 参考

onfullscreenchange: (this: Document, ev: Event) => any | null

属性值

(this: Document, ev: Event) => any | null

onfullscreenerror

MDN 参考

onfullscreenerror: (this: Document, ev: Event) => any | null

属性值

(this: Document, ev: Event) => any | null

onpointerlockchange

MDN 参考

onpointerlockchange: (this: Document, ev: Event) => any | null

属性值

(this: Document, ev: Event) => any | null

onpointerlockerror

MDN 参考

onpointerlockerror: (this: Document, ev: Event) => any | null

属性值

(this: Document, ev: Event) => any | null

onreadystatechange

MDN 参考

onreadystatechange: (this: Document, ev: Event) => any | null

属性值

(this: Document, ev: Event) => any | null

onvisibilitychange

MDN 参考

onvisibilitychange: (this: Document, ev: Event) => any | null

属性值

(this: Document, ev: Event) => any | null

ownerDocument

Node 接口的只读 ownerDocument 属性返回节点的顶级文档对象。

MDN 参考

ownerDocument: null

属性值

null

pictureInPictureEnabled

可用的只读 pictureInPictureEnabled 属性。

MDN 参考

pictureInPictureEnabled: boolean

属性值

boolean

plugins

plugins包含一个或多个表示 HTMLCollection 的 HTMLEmbedElements 的只读属性。

MDN 参考

plugins: HTMLCollectionOf<HTMLEmbedElement>

属性值

HTMLCollectionOf<HTMLEmbedElement>

readyState

该 Document.readyState 属性描述文档的加载状态。

MDN 参考

readyState: DocumentReadyState

属性值

DocumentReadyState

referrer

该 Document.referrer 属性返回链接到此页面的页面的 URI。

MDN 参考

referrer: string

属性值

string

rootElement

警告

现已弃用此 API。

MDN Reference

Document.rootElement 如果文档是文档,则返回作为文档根元素的元素。

rootElement: SVGSVGElement | null

属性值

SVGSVGElement | null

scripts

scripts Document 接口的属性返回文档中脚本元素的列表。

MDN 参考

scripts: HTMLCollectionOf<HTMLScriptElement>

属性值

HTMLCollectionOf<HTMLScriptElement>

scrollingElement

滚动 scrollingElement 文档的只读属性。

MDN 参考

scrollingElement: Element | null

属性值

Element | null

textContent

MDN 参考

null textContent

属性值

null

timeline

timeline Document 接口的只读属性表示当前文档的默认时间线。

MDN 参考

timeline: DocumentTimeline

属性值

DocumentTimeline

title

该 document.title 属性获取或设置文档的当前标题。

MDN 参考

title: string

属性值

string

URL

URL Document 接口的只读属性将文档位置作为字符串返回。

MDN 参考

URL: string

属性值

string

visibilityState

Document.visibilityState只读属性返回文档的可见性。

MDN 参考

visibilityState: DocumentVisibilityState

属性值

DocumentVisibilityState

vlinkColor

警告

现已弃用此 API。

MDN Reference

该 Document.vlinkColor 属性获取/设置用户在文档中访问的链接的颜色。

vlinkColor: string

属性值

string

webkitExitFullscreen

webkitExitFullscreen: void

属性值

void

继承属性详细信息

activeElement

返回文档中最深的元素,其中或要路由到哪些关键事件。 大致而言,这是文档中重点元素。

出于此 API 的目的,当子浏览上下文聚焦时,其容器将集中在父浏览上下文中。 例如,如果用户将焦点移动到 iframe 中的文本控件,则 iframe 是 iframe 节点文档中 activeElement API 返回的元素。

同样,当焦点元素位于与 documentOrShadowRoot 不同的节点树中时,返回的元素将是与 documentOrShadowRoot 位于同一节点树中的主机(如果 documentOrShadowRoot 是包含包含焦点元素的独占上级),如果不是,则返回的元素将为 null。

MDN 参考

activeElement: Element | null

属性值

Element | null

继承自 DocumentOrShadowRoot.activeElement

adoptedStyleSheets

MDN 参考

adoptedStyleSheets: CSSStyleSheet[]

属性值

CSSStyleSheet[]

继承自 DocumentOrShadowRoot.adoptedStyleSheets

ATTRIBUTE_NODE

ATTRIBUTE_NODE: 2

属性值

2

继承自 Node.ATTRIBUTE_NODE 的

baseURI

Node 接口的只读 baseURI 属性返回包含节点的文档的绝对基 URL。

MDN 参考

baseURI: string

属性值

string

继承自 Node.baseURI

CDATA_SECTION_NODE

节点是 CDATASection 节点。

CDATA_SECTION_NODE: 4

属性值

4

继承自 Node.CDATA_SECTION_NODE 的

childElementCount

MDN 参考

childElementCount: number

属性值

number

继承自 ParentNode.childElementCount

childNodes

Node 接口的只读 childNodes 属性返回分配了第一个子节点的实时索引 0。

MDN 参考

childNodes: NodeListOf<ChildNode>

属性值

NodeListOf<ChildNode>

继承自 Node.childNodes

children

返回子元素。

MDN 参考

children: HTMLCollection

属性值

HTMLCollection

继承自 ParentNode.children

COMMENT_NODE

节点是注释节点。

COMMENT_NODE: 8

属性值

8

继承自 Node.COMMENT_NODE 的

DOCUMENT_FRAGMENT_NODE

节点是 DocumentFragment 节点。

DOCUMENT_FRAGMENT_NODE: 11

属性值

11

继承自 Node.DOCUMENT_FRAGMENT_NODE 的

DOCUMENT_NODE

节点是文档。

DOCUMENT_NODE: 9

属性值

9

继承自 Node.DOCUMENT_NODE 的

DOCUMENT_POSITION_CONTAINED_BY

当其他节点是节点的后代时设置。

DOCUMENT_POSITION_CONTAINED_BY: 16

属性值

16

继承自 Node.DOCUMENT_POSITION_CONTAINED_BY 的

DOCUMENT_POSITION_CONTAINS

当其他节点是节点的上级时设置。

DOCUMENT_POSITION_CONTAINS: 8

属性值

8

继承自 Node.DOCUMENT_POSITION_CONTAINS

DOCUMENT_POSITION_DISCONNECTED

当节点和其他节点不在同一树中时设置。

DOCUMENT_POSITION_DISCONNECTED: 1

属性值

1

继承自 Node.DOCUMENT_POSITION_DISCONNECTED 的

DOCUMENT_POSITION_FOLLOWING

当其他节点位于以下节点时设置。

DOCUMENT_POSITION_FOLLOWING: 4

属性值

4

继承自 Node.DOCUMENT_POSITION_FOLLOWING 的

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32

属性值

32

继承自 Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC 的

DOCUMENT_POSITION_PRECEDING

设置其他节点之前的节点。

DOCUMENT_POSITION_PRECEDING: 2

属性值

2

继承自 Node.DOCUMENT_POSITION_PRECEDING 的

DOCUMENT_TYPE_NODE

node 是 doctype。

DOCUMENT_TYPE_NODE: 10

属性值

10

继承自 Node.DOCUMENT_TYPE_NODE 的

ELEMENT_NODE

node 是一个元素。

ELEMENT_NODE: 1

属性值

1

继承自 Node.ELEMENT_NODE 的

ENTITY_NODE

ENTITY_NODE: 6

属性值

6

继承自 Node.ENTITY_NODE 的

ENTITY_REFERENCE_NODE

ENTITY_REFERENCE_NODE: 5

属性值

5

继承自 Node.ENTITY_REFERENCE_NODE 的

firstChild

Node 接口的只读 firstChild 属性返回节点在树中的第一个子级,或者 null 节点没有子级。

MDN 参考

firstChild: ChildNode | null

属性值

ChildNode | null

继承自 Node.firstChild

firstElementChild

返回作为元素的第一个子级,否则返回 null。

MDN 参考

firstElementChild: Element | null

属性值

Element | null

继承自 ParentNode.firstElementChild

fonts

MDN 参考

fonts: FontFaceSet

属性值

FontFaceSet

继承自 FontFaceSource.fonts

fullscreenElement

返回文档的全屏元素。

MDN 参考

fullscreenElement: Element | null

属性值

Element | null

继承自 DocumentOrShadowRoot.fullscreenElement

isConnected

Node 接口的只读 isConnected 属性返回一个布尔值,指示节点是直接还是间接地连接到 Document 对象。

MDN 参考

isConnected: boolean

属性值

boolean

继承自 Node.isConnected

lastChild

Node 接口的只读 lastChild 属性返回节点的最后一个子级,或者 null 如果没有子节点。

MDN 参考

lastChild: ChildNode | null

属性值

ChildNode | null

继承自 Node.lastChild

lastElementChild

返回作为元素的最后一个子级,否则返回 null。

MDN 参考

lastElementChild: Element | null

属性值

Element | null

继承自 ParentNode.lastElementChild

nextSibling

Node 接口的只读 nextSibling 属性将紧跟在其父节点的 Node.childNodes 中的指定节点之后返回节点,或者如果指定节点是父元素中的最后一个子节点,则返回 null 该节点。

MDN 参考

nextSibling: ChildNode | null

属性值

ChildNode | null

继承自 Node.nextSibling

nodeName

Node 的只读 nodeName 属性将当前节点的名称作为字符串返回。

MDN 参考

nodeName: string

属性值

string

继承自 Node.nodeName

nodeType

Node 接口的只读 nodeType 属性是一个整数,用于标识节点是什么。

MDN 参考

nodeType: number

属性值

number

继承自 Node.nodeType

nodeValue

nodeValue Node 接口的属性返回或设置当前节点的值。

MDN 参考

nodeValue: string | null

属性值

string | null

继承自 Node.nodeValue

NOTATION_NODE

NOTATION_NODE: 12

属性值

12

继承自 Node.NOTATION_NODE 的

onabort

MDN 参考

onabort: (this: GlobalEventHandlers, ev: UIEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: UIEvent) => any | null

继承自 GlobalEventHandlers.onabort

onanimationcancel

MDN 参考

onanimationcancel: (this: GlobalEventHandlers, ev: AnimationEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: AnimationEvent) => any | null

继承自 GlobalEventHandlers.onanimationcancel

onanimationend

MDN 参考

onanimationend: (this: GlobalEventHandlers, ev: AnimationEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: AnimationEvent) => any | null

继承自 GlobalEventHandlers.onanimationend

onanimationiteration

MDN 参考

onanimationiteration: (this: GlobalEventHandlers, ev: AnimationEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: AnimationEvent) => any | null

继承自 GlobalEventHandlers.onanimationiteration

onanimationstart

MDN 参考

onanimationstart: (this: GlobalEventHandlers, ev: AnimationEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: AnimationEvent) => any | null

继承自 GlobalEventHandlers.onanimationstart

onauxclick

MDN 参考

onauxclick: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onauxclick

onbeforeinput

MDN 参考

onbeforeinput: (this: GlobalEventHandlers, ev: InputEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: InputEvent) => any | null

继承自 GlobalEventHandlers.onbeforeinput

onbeforematch

MDN 参考

onbeforematch: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onbeforematch

onbeforetoggle

MDN 参考

onbeforetoggle: (this: GlobalEventHandlers, ev: ToggleEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: ToggleEvent) => any | null

继承自 GlobalEventHandlers.onbeforetoggle

onblur

MDN 参考

onblur: (this: GlobalEventHandlers, ev: FocusEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: FocusEvent) => any | null

继承自 GlobalEventHandlers.onblur

oncancel

MDN 参考

oncancel: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 globalEventHandlers.oncancel 的

oncanplay

MDN 参考

oncanplay: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oncanplay

oncanplaythrough

MDN 参考

oncanplaythrough: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oncanplaythrough

onchange

MDN 参考

onchange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onchange

onclick

MDN 参考

onclick: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onclick

onclose

MDN 参考

onclose: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onclose

oncontextlost

MDN 参考

oncontextlost: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oncontextlost

oncontextmenu

MDN 参考

oncontextmenu: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.oncontextmenu

oncontextrestored

MDN 参考

oncontextrestored: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oncontextrestored

oncopy

MDN 参考

oncopy: (this: GlobalEventHandlers, ev: ClipboardEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: ClipboardEvent) => any | null

继承自 GlobalEventHandlers.oncopy

oncuechange

MDN 参考

oncuechange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oncuechange

oncut

MDN 参考

oncut: (this: GlobalEventHandlers, ev: ClipboardEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: ClipboardEvent) => any | null

继承自 GlobalEventHandlers.oncut

ondblclick

MDN 参考

ondblclick: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.ondblclick

ondrag

MDN 参考

ondrag: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondrag

ondragend

MDN 参考

ondragend: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondragend

ondragenter

MDN 参考

ondragenter: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondragenter

ondragleave

MDN 参考

ondragleave: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondragleave

ondragover

MDN 参考

ondragover: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondragover

ondragstart

MDN 参考

ondragstart: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondragstart

ondrop

MDN 参考

ondrop: (this: GlobalEventHandlers, ev: DragEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: DragEvent) => any | null

继承自 GlobalEventHandlers.ondrop

ondurationchange

MDN 参考

ondurationchange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.ondurationchange

onemptied

MDN 参考

onemptied: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onemptied

onended

MDN 参考

onended: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onended

onerror

MDN 参考

onerror: OnErrorEventHandler

属性值

OnErrorEventHandler

继承自 GlobalEventHandlers.onerror

onfocus

MDN 参考

onfocus: (this: GlobalEventHandlers, ev: FocusEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: FocusEvent) => any | null

继承自 GlobalEventHandlers.onfocus

onformdata

MDN 参考

onformdata: (this: GlobalEventHandlers, ev: FormDataEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: FormDataEvent) => any | null

继承自 GlobalEventHandlers.onformdata

ongotpointercapture

MDN 参考

ongotpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.ongotpointercapture

oninput

MDN 参考

oninput: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oninput

oninvalid

MDN 参考

oninvalid: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.oninvalid

onkeydown

MDN 参考

onkeydown: (this: GlobalEventHandlers, ev: KeyboardEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: KeyboardEvent) => any | null

继承自 GlobalEventHandlers.onkeydown

onkeypress

警告

现已弃用此 API。

MDN Reference

onkeypress: (this: GlobalEventHandlers, ev: KeyboardEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: KeyboardEvent) => any | null

继承自 GlobalEventHandlers.onkeypress 的

onkeyup

MDN 参考

onkeyup: (this: GlobalEventHandlers, ev: KeyboardEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: KeyboardEvent) => any | null

继承自 GlobalEventHandlers.onkeyup

onload

MDN 参考

onload: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onload

onloadeddata

MDN 参考

onloadeddata: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onloadeddata

onloadedmetadata

MDN 参考

onloadedmetadata: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onloadedmetadata

onloadstart

MDN 参考

onloadstart: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onloadstart

onlostpointercapture

MDN 参考

onlostpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onlostpointercapture

onmousedown

MDN 参考

onmousedown: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmousedown

onmouseenter

MDN 参考

onmouseenter: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmouseenter

onmouseleave

MDN 参考

onmouseleave: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmouseleave

onmousemove

MDN 参考

onmousemove: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmousemove

onmouseout

MDN 参考

onmouseout: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmouseout

onmouseover

MDN 参考

onmouseover: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmouseover

onmouseup

MDN 参考

onmouseup: (this: GlobalEventHandlers, ev: MouseEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: MouseEvent) => any | null

继承自 GlobalEventHandlers.onmouseup

onpaste

MDN 参考

onpaste: (this: GlobalEventHandlers, ev: ClipboardEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: ClipboardEvent) => any | null

继承自 GlobalEventHandlers.onpaste

onpause

MDN 参考

onpause: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onpause

onplay

MDN 参考

onplay: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onplay

onplaying

MDN 参考

onplaying: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onplaying

onpointercancel

MDN 参考

onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointercancel

onpointerdown

MDN 参考

onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointerdown

onpointerenter

MDN 参考

onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointerenter

onpointerleave

MDN 参考

onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointerleave

onpointermove

MDN 参考

onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointermove

onpointerout

MDN 参考

onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointerout

onpointerover

MDN 参考

onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointerover

onpointerrawupdate

仅在安全上下文中可用。

MDN 参考

onpointerrawupdate: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onpointerrawupdate

onpointerup

MDN 参考

onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: PointerEvent) => any | null

继承自 GlobalEventHandlers.onpointerup

onprogress

MDN 参考

onprogress: (this: GlobalEventHandlers, ev: ProgressEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: ProgressEvent) => any | null

继承自 GlobalEventHandlers.onprogress

onratechange

MDN 参考

onratechange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onratechange

onreset

MDN 参考

onreset: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onreset

onresize

MDN 参考

onresize: (this: GlobalEventHandlers, ev: UIEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: UIEvent) => any | null

继承自 GlobalEventHandlers.onresize

onscroll

MDN 参考

onscroll: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onscroll

onscrollend

MDN 参考

onscrollend: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onscrollend

onsecuritypolicyviolation

MDN 参考

onsecuritypolicyviolation: (this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any | null

继承自 GlobalEventHandlers.onsecuritypolicyviolation

onseeked

MDN 参考

onseeked: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onseeked

onseeking

MDN 参考

onseeking: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onseeking

onselect

MDN 参考

onselect: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onselect

onselectionchange

MDN 参考

onselectionchange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onselectionchange

onselectstart

MDN 参考

onselectstart: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onselectstart

onslotchange

MDN 参考

onslotchange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onslotchange

onstalled

MDN 参考

onstalled: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onstalled

onsubmit

MDN 参考

onsubmit: (this: GlobalEventHandlers, ev: SubmitEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: SubmitEvent) => any | null

继承自 GlobalEventHandlers.onsubmit

onsuspend

MDN 参考

onsuspend: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onsuspend

ontimeupdate

MDN 参考

ontimeupdate: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.ontimeupdate

ontoggle

MDN 参考

ontoggle: (this: GlobalEventHandlers, ev: ToggleEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: ToggleEvent) => any | null

继承自 GlobalEventHandlers.onggle

ontouchcancel

MDN 参考

ontouchcancel?: (this: GlobalEventHandlers, ev: TouchEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TouchEvent) => any | null

继承自 GlobalEventHandlers.ontouchcancel

ontouchend

MDN 参考

ontouchend?: (this: GlobalEventHandlers, ev: TouchEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TouchEvent) => any | null

继承自 GlobalEventHandlers.ontouchend

ontouchmove

MDN 参考

ontouchmove?: (this: GlobalEventHandlers, ev: TouchEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TouchEvent) => any | null

继承自 GlobalEventHandlers.ontouchmove

ontouchstart

MDN 参考

ontouchstart?: (this: GlobalEventHandlers, ev: TouchEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TouchEvent) => any | null

继承自 GlobalEventHandlers.ontouchstart

ontransitioncancel

MDN 参考

ontransitioncancel: (this: GlobalEventHandlers, ev: TransitionEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TransitionEvent) => any | null

继承自 GlobalEventHandlers.ontransitioncancel

ontransitionend

MDN 参考

ontransitionend: (this: GlobalEventHandlers, ev: TransitionEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TransitionEvent) => any | null

继承自 GlobalEventHandlers.ontransitionend

ontransitionrun

MDN 参考

ontransitionrun: (this: GlobalEventHandlers, ev: TransitionEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TransitionEvent) => any | null

继承自 GlobalEventHandlers.ontransitionrun

ontransitionstart

MDN 参考

ontransitionstart: (this: GlobalEventHandlers, ev: TransitionEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: TransitionEvent) => any | null

继承自 GlobalEventHandlers.ontransitionstart

onvolumechange

MDN 参考

onvolumechange: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onvolumechange

onwaiting

MDN 参考

onwaiting: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onwaiting

onwebkitanimationend

警告

现已弃用此 API。

This is a legacy alias of onanimationend.

MDN Reference

onwebkitanimationend: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onwebkitanimationend

onwebkitanimationiteration

警告

现已弃用此 API。

This is a legacy alias of onanimationiteration.

MDN Reference

onwebkitanimationiteration: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onwebkitanimationiteration

onwebkitanimationstart

警告

现已弃用此 API。

This is a legacy alias of onanimationstart.

MDN Reference

onwebkitanimationstart: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onwebkitanimationstart

onwebkittransitionend

警告

现已弃用此 API。

This is a legacy alias of ontransitionend.

MDN Reference

onwebkittransitionend: (this: GlobalEventHandlers, ev: Event) => any | null

属性值

(this: GlobalEventHandlers, ev: Event) => any | null

继承自 GlobalEventHandlers.onwebkittransitionend

onwheel

MDN 参考

onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any | null

属性值

(this: GlobalEventHandlers, ev: WheelEvent) => any | null

继承自 GlobalEventHandlers.onwheel

parentElement

Node 接口的只读 parentElement 属性返回 DOM 节点的父元素,或者 null 节点没有父元素,或者其父元素不是 DOM 元素。

MDN 参考

parentElement: HTMLElement | null

属性值

HTMLElement | null

继承自 Node.parentElement

parentNode

Node 接口的只读 parentNode 属性返回 DOM 树中指定节点的父级。

MDN 参考

parentNode: ParentNode | null

属性值

ParentNode | null

继承自 Node.parentNode

pictureInPictureElement

MDN 参考

pictureInPictureElement: Element | null

属性值

Element | null

继承自 DocumentOrShadowRoot.pictureInPictureElement

pointerLockElement

MDN 参考

pointerLockElement: Element | null

属性值

Element | null

继承自 DocumentOrShadowRoot.pointerLockElement

previousSibling

Node 接口的只读 previousSibling 属性返回紧邻其父节点中指定节点的前面,或者 null 指定节点是该列表中的第一个节点。

MDN 参考

previousSibling: ChildNode | null

属性值

ChildNode | null

继承自 Node.previousSibling

PROCESSING_INSTRUCTION_NODE

节点是 ProcessingInstruction 节点。

PROCESSING_INSTRUCTION_NODE: 7

属性值

7

继承自 Node.PROCESSING_INSTRUCTION_NODE 的

styleSheets

MDN 参考

styleSheets: StyleSheetList

属性值

StyleSheetList

继承自 DocumentOrShadowRoot.styleSheets

TEXT_NODE

节点是文本节点。

TEXT_NODE: 3

属性值

3

继承自 Node.TEXT_NODE 的

方法详细信息

addEventListener(string, EventListenerOrEventListenerObject, boolean | AddEventListenerOptions)

function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions)

参数

type

string

listener

EventListenerOrEventListenerObject

options

boolean | AddEventListenerOptions

addEventListener<K>(K, (this: Document, ev: DocumentEventMap[K]) => any, boolean | AddEventListenerOptions)

addEventListener() EventTarget 接口的方法设置一个函数,每当指定事件传递到目标时,就会调用该函数。

MDN 参考

function addEventListener<K>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions)

参数

type

K

listener

(this: Document, ev: DocumentEventMap[K]) => any

options

boolean | AddEventListenerOptions

adoptNode<T>(T)

Document.adoptNode() 将节点/dom 从另一个文档传输到方法的文档。

MDN 参考

function adoptNode<T>(node: T): T

参数

node

T

返回

T

captureEvents()

警告

现已弃用此 API。

function captureEvents()

caretPositionFromPoint(number, number, CaretPositionFromPointOptions)

caretPositionFromPoint() Document 接口的方法返回一个 CaretPosition 对象,该对象包含 DOM 节点,以及该节点中的插入符号和插入符号的字符偏移量。

MDN 参考

function caretPositionFromPoint(x: number, y: number, options?: CaretPositionFromPointOptions): CaretPosition | null

参数

x

number

y

number

options

CaretPositionFromPointOptions

返回

CaretPosition | null

caretRangeFromPoint(number, number)

警告

现已弃用此 API。

function caretRangeFromPoint(x: number, y: number): Range | null

参数

x

number

y

number

返回

Range | null

clear()

警告

现已弃用此 API。

MDN Reference

该方法 Document.clear() 不执行任何操作,但不引发任何错误。

function clear()

close()

该方法 Document.close() 完成对文档的写入,使用 Document.open(打开)。

MDN 参考

function close()

createAttribute(string)

该方法 Document.createAttribute() 创建新的属性节点,并返回它。

MDN 参考

function createAttribute(localName: string): Attr

参数

localName

string

返回

Attr

createAttributeNS(string | null, string)

该方法 Document.createAttributeNS() 创建一个具有指定命名空间 URI 和限定名称的新属性节点,并返回它。

MDN 参考

function createAttributeNS(namespace: string | null, qualifiedName: string): Attr

参数

namespace

string | null

qualifiedName

string

返回

Attr

createCDATASection(string)

createCDATASection() 创建新的 CDATA 节节点,并返回它。

MDN 参考

function createCDATASection(data: string): CDATASection

参数

data

string

返回

CDATASection

createComment(string)

createComment() 创建新的注释节点并返回它。

MDN 参考

function createComment(data: string): Comment

参数

data

string

返回

Comment

createDocumentFragment()

创建一个新的空 DocumentFragment,可以将 DOM 节点添加到其中以生成屏幕外 DOM 树。

MDN 参考

function createDocumentFragment(): DocumentFragment

返回

DocumentFragment

createElement(string, ElementCreationOptions)

function createElement(tagName: string, options?: ElementCreationOptions): HTMLElement

参数

tagName

string

options

ElementCreationOptions

返回

HTMLElement

createElement<K>(K, ElementCreationOptions)

在 HTML 文档中,该方法创建由 localNamedocument.createElement() 指定的 HTML 元素;如果localName无法识别,则创建 HTMLUnknownElement。

MDN 参考

function createElement<K>(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]

参数

tagName

K

options

ElementCreationOptions

返回

HTMLElementTagNameMap[K]

createElement<K>(K, ElementCreationOptions)

警告

现已弃用此 API。

function createElement<K>(tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]

参数

tagName

K

options

ElementCreationOptions

返回

HTMLElementDeprecatedTagNameMap[K]

createElementNS("http://www.w3.org/1998/Math/MathML", string)

function createElementNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: string): MathMLElement

参数

namespaceURI

"http://www.w3.org/1998/Math/MathML"

qualifiedName

string

返回

MathMLElement

createElementNS("http://www.w3.org/1999/xhtml", string)

创建具有指定命名空间 URI 和限定名称的元素。

MDN 参考

function createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement

参数

namespaceURI

"http://www.w3.org/1999/xhtml"

qualifiedName

string

返回

HTMLElement

createElementNS("http://www.w3.org/2000/svg", string)

function createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement

参数

namespaceURI

"http://www.w3.org/2000/svg"

qualifiedName

string

返回

SVGElement

createElementNS(string | null, string, ElementCreationOptions)

function createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element

参数

namespaceURI

string | null

qualifiedName

string

options

ElementCreationOptions

返回

Element

createElementNS(string | null, string, string | ElementCreationOptions)

function createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element

参数

namespace

string | null

qualifiedName

string

options

string | ElementCreationOptions

返回

Element

createElementNS<K>("http://www.w3.org/1998/Math/MathML", K)

function createElementNS<K>(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: K): MathMLElementTagNameMap[K]

参数

namespaceURI

"http://www.w3.org/1998/Math/MathML"

qualifiedName

K

返回

MathMLElementTagNameMap[K]

createElementNS<K>("http://www.w3.org/2000/svg", K)

function createElementNS<K>(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]

参数

namespaceURI

"http://www.w3.org/2000/svg"

qualifiedName

K

返回

SVGElementTagNameMap[K]

createEvent("AnimationEvent")

警告

现已弃用此 API。

MDN Reference

创建指定类型的事件。

function createEvent(eventInterface: "AnimationEvent"): AnimationEvent

参数

eventInterface

"AnimationEvent"

返回

AnimationEvent

createEvent("AnimationPlaybackEvent")

function createEvent(eventInterface: "AnimationPlaybackEvent"): AnimationPlaybackEvent

参数

eventInterface

"AnimationPlaybackEvent"

返回

AnimationPlaybackEvent

createEvent("AudioProcessingEvent")

function createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent

参数

eventInterface

"AudioProcessingEvent"

返回

AudioProcessingEvent

createEvent("BeforeUnloadEvent")

function createEvent(eventInterface: "BeforeUnloadEvent"): BeforeUnloadEvent

参数

eventInterface

"BeforeUnloadEvent"

返回

BeforeUnloadEvent

createEvent("BlobEvent")

function createEvent(eventInterface: "BlobEvent"): BlobEvent

参数

eventInterface

"BlobEvent"

返回

BlobEvent

createEvent("ClipboardEvent")

function createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent

参数

eventInterface

"ClipboardEvent"

返回

ClipboardEvent

createEvent("CloseEvent")

function createEvent(eventInterface: "CloseEvent"): CloseEvent

参数

eventInterface

"CloseEvent"

返回

CloseEvent

createEvent("CompositionEvent")

function createEvent(eventInterface: "CompositionEvent"): CompositionEvent

参数

eventInterface

"CompositionEvent"

返回

CompositionEvent

createEvent("ContentVisibilityAutoStateChangeEvent")

function createEvent(eventInterface: "ContentVisibilityAutoStateChangeEvent"): ContentVisibilityAutoStateChangeEvent

参数

eventInterface

"ContentVisibilityAutoStateChangeEvent"

返回

ContentVisibilityAutoStateChangeEvent

createEvent("CookieChangeEvent")

function createEvent(eventInterface: "CookieChangeEvent"): CookieChangeEvent

参数

eventInterface

"CookieChangeEvent"

返回

CookieChangeEvent

createEvent("CustomEvent")

function createEvent(eventInterface: "CustomEvent"): CustomEvent

参数

eventInterface

"CustomEvent"

返回

CustomEvent

createEvent("DeviceMotionEvent")

function createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent

参数

eventInterface

"DeviceMotionEvent"

返回

DeviceMotionEvent

createEvent("DeviceOrientationEvent")

function createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent

参数

eventInterface

"DeviceOrientationEvent"

返回

DeviceOrientationEvent

createEvent("DragEvent")

function createEvent(eventInterface: "DragEvent"): DragEvent

参数

eventInterface

"DragEvent"

返回

DragEvent

createEvent("ErrorEvent")

function createEvent(eventInterface: "ErrorEvent"): ErrorEvent

参数

eventInterface

"ErrorEvent"

返回

ErrorEvent

createEvent("Event")

function createEvent(eventInterface: "Event"): Event

参数

eventInterface

"Event"

返回

Event

createEvent("Events")

function createEvent(eventInterface: "Events"): Event

参数

eventInterface

"Events"

返回

Event

createEvent("FocusEvent")

function createEvent(eventInterface: "FocusEvent"): FocusEvent

参数

eventInterface

"FocusEvent"

返回

FocusEvent

createEvent("FontFaceSetLoadEvent")

function createEvent(eventInterface: "FontFaceSetLoadEvent"): FontFaceSetLoadEvent

参数

eventInterface

"FontFaceSetLoadEvent"

返回

FontFaceSetLoadEvent

createEvent("FormDataEvent")

function createEvent(eventInterface: "FormDataEvent"): FormDataEvent

参数

eventInterface

"FormDataEvent"

返回

FormDataEvent

createEvent("GamepadEvent")

function createEvent(eventInterface: "GamepadEvent"): GamepadEvent

参数

eventInterface

"GamepadEvent"

返回

GamepadEvent

createEvent("HashChangeEvent")

function createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent

参数

eventInterface

"HashChangeEvent"

返回

HashChangeEvent

createEvent("IDBVersionChangeEvent")

function createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent

参数

eventInterface

"IDBVersionChangeEvent"

返回

IDBVersionChangeEvent

createEvent("InputEvent")

function createEvent(eventInterface: "InputEvent"): InputEvent

参数

eventInterface

"InputEvent"

返回

InputEvent

createEvent("KeyboardEvent")

function createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent

参数

eventInterface

"KeyboardEvent"

返回

KeyboardEvent

createEvent("MediaEncryptedEvent")

function createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent

参数

eventInterface

"MediaEncryptedEvent"

返回

MediaEncryptedEvent

createEvent("MediaKeyMessageEvent")

function createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent

参数

eventInterface

"MediaKeyMessageEvent"

返回

MediaKeyMessageEvent

createEvent("MediaQueryListEvent")

function createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent

参数

eventInterface

"MediaQueryListEvent"

返回

MediaQueryListEvent

createEvent("MediaStreamTrackEvent")

function createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent

参数

eventInterface

"MediaStreamTrackEvent"

返回

MediaStreamTrackEvent

createEvent("MessageEvent")

function createEvent(eventInterface: "MessageEvent"): MessageEvent

参数

eventInterface

"MessageEvent"

返回

MessageEvent

createEvent("MIDIConnectionEvent")

function createEvent(eventInterface: "MIDIConnectionEvent"): MIDIConnectionEvent

参数

eventInterface

"MIDIConnectionEvent"

返回

MIDIConnectionEvent

createEvent("MIDIMessageEvent")

function createEvent(eventInterface: "MIDIMessageEvent"): MIDIMessageEvent

参数

eventInterface

"MIDIMessageEvent"

返回

MIDIMessageEvent

createEvent("MouseEvent")

function createEvent(eventInterface: "MouseEvent"): MouseEvent

参数

eventInterface

"MouseEvent"

返回

MouseEvent

createEvent("MouseEvents")

function createEvent(eventInterface: "MouseEvents"): MouseEvent

参数

eventInterface

"MouseEvents"

返回

MouseEvent

createEvent("OfflineAudioCompletionEvent")

function createEvent(eventInterface: "OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent

参数

eventInterface

"OfflineAudioCompletionEvent"

返回

OfflineAudioCompletionEvent

createEvent("PageRevealEvent")

function createEvent(eventInterface: "PageRevealEvent"): PageRevealEvent

参数

eventInterface

"PageRevealEvent"

返回

PageRevealEvent

createEvent("PageSwapEvent")

function createEvent(eventInterface: "PageSwapEvent"): PageSwapEvent

参数

eventInterface

"PageSwapEvent"

返回

PageSwapEvent

createEvent("PageTransitionEvent")

function createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent

参数

eventInterface

"PageTransitionEvent"

返回

PageTransitionEvent

createEvent("PaymentMethodChangeEvent")

function createEvent(eventInterface: "PaymentMethodChangeEvent"): PaymentMethodChangeEvent

参数

eventInterface

"PaymentMethodChangeEvent"

返回

PaymentMethodChangeEvent

createEvent("PaymentRequestUpdateEvent")

function createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent

参数

eventInterface

"PaymentRequestUpdateEvent"

返回

PaymentRequestUpdateEvent

createEvent("PictureInPictureEvent")

function createEvent(eventInterface: "PictureInPictureEvent"): PictureInPictureEvent

参数

eventInterface

"PictureInPictureEvent"

返回

PictureInPictureEvent

createEvent("PointerEvent")

function createEvent(eventInterface: "PointerEvent"): PointerEvent

参数

eventInterface

"PointerEvent"

返回

PointerEvent

createEvent("PopStateEvent")

function createEvent(eventInterface: "PopStateEvent"): PopStateEvent

参数

eventInterface

"PopStateEvent"

返回

PopStateEvent

createEvent("ProgressEvent")

function createEvent(eventInterface: "ProgressEvent"): ProgressEvent

参数

eventInterface

"ProgressEvent"

返回

ProgressEvent

createEvent("PromiseRejectionEvent")

function createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent

参数

eventInterface

"PromiseRejectionEvent"

返回

PromiseRejectionEvent

createEvent("RTCDataChannelEvent")

function createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent

参数

eventInterface

"RTCDataChannelEvent"

返回

RTCDataChannelEvent

createEvent("RTCDTMFToneChangeEvent")

function createEvent(eventInterface: "RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent

参数

eventInterface

"RTCDTMFToneChangeEvent"

返回

RTCDTMFToneChangeEvent

createEvent("RTCErrorEvent")

function createEvent(eventInterface: "RTCErrorEvent"): RTCErrorEvent

参数

eventInterface

"RTCErrorEvent"

返回

RTCErrorEvent

createEvent("RTCPeerConnectionIceErrorEvent")

function createEvent(eventInterface: "RTCPeerConnectionIceErrorEvent"): RTCPeerConnectionIceErrorEvent

参数

eventInterface

"RTCPeerConnectionIceErrorEvent"

返回

RTCPeerConnectionIceErrorEvent

createEvent("RTCPeerConnectionIceEvent")

function createEvent(eventInterface: "RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent

参数

eventInterface

"RTCPeerConnectionIceEvent"

返回

RTCPeerConnectionIceEvent

createEvent("RTCTrackEvent")

function createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent

参数

eventInterface

"RTCTrackEvent"

返回

RTCTrackEvent

createEvent("SecurityPolicyViolationEvent")

function createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent

参数

eventInterface

"SecurityPolicyViolationEvent"

返回

SecurityPolicyViolationEvent

createEvent("SpeechSynthesisErrorEvent")

function createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent

参数

eventInterface

"SpeechSynthesisErrorEvent"

返回

SpeechSynthesisErrorEvent

createEvent("SpeechSynthesisEvent")

function createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent

参数

eventInterface

"SpeechSynthesisEvent"

返回

SpeechSynthesisEvent

createEvent("StorageEvent")

function createEvent(eventInterface: "StorageEvent"): StorageEvent

参数

eventInterface

"StorageEvent"

返回

StorageEvent

createEvent("SubmitEvent")

function createEvent(eventInterface: "SubmitEvent"): SubmitEvent

参数

eventInterface

"SubmitEvent"

返回

SubmitEvent

createEvent("TextEvent")

function createEvent(eventInterface: "TextEvent"): TextEvent

参数

eventInterface

"TextEvent"

返回

TextEvent

createEvent("ToggleEvent")

function createEvent(eventInterface: "ToggleEvent"): ToggleEvent

参数

eventInterface

"ToggleEvent"

返回

ToggleEvent

createEvent("TouchEvent")

function createEvent(eventInterface: "TouchEvent"): TouchEvent

参数

eventInterface

"TouchEvent"

返回

TouchEvent

createEvent("TrackEvent")

function createEvent(eventInterface: "TrackEvent"): TrackEvent

参数

eventInterface

"TrackEvent"

返回

TrackEvent

createEvent("TransitionEvent")

function createEvent(eventInterface: "TransitionEvent"): TransitionEvent

参数

eventInterface

"TransitionEvent"

返回

TransitionEvent

createEvent("UIEvent")

function createEvent(eventInterface: "UIEvent"): UIEvent

参数

eventInterface

"UIEvent"

返回

UIEvent

createEvent("UIEvents")

function createEvent(eventInterface: "UIEvents"): UIEvent

参数

eventInterface

"UIEvents"

返回

UIEvent

createEvent("WebGLContextEvent")

function createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent

参数

eventInterface

"WebGLContextEvent"

返回

WebGLContextEvent

createEvent("WheelEvent")

function createEvent(eventInterface: "WheelEvent"): WheelEvent

参数

eventInterface

"WheelEvent"

返回

WheelEvent

createEvent(string)

function createEvent(eventInterface: string): Event

参数

eventInterface

string

返回

Event

createNodeIterator(Node, number, NodeFilter | null)

该方法 Document.createNodeIterator() 返回一个新 NodeIterator 对象。

MDN 参考

function createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator

参数

root

Node

whatToShow

number

filter

NodeFilter | null

返回

NodeIterator

createProcessingInstruction(string, string)

createProcessingInstruction() 生成新的处理指令节点并返回它。

MDN 参考

function createProcessingInstruction(target: string, data: string): ProcessingInstruction

参数

target

string

data

string

返回

ProcessingInstruction

createRange()

该方法 Document.createRange() 返回新的 js-nolint createRange() None。

MDN 参考

function createRange(): Range

返回

Range

createTextNode(string)

创建新的“文本”节点。

MDN 参考

function createTextNode(data: string): Text

参数

data

string

返回

Text

createTreeWalker(Node, number, NodeFilter | null)

创建 Document.createTreeWalker() 者方法返回新创建的 TreeWalker 对象。

MDN 参考

function createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker

参数

root

Node

whatToShow

number

filter

NodeFilter | null

返回

TreeWalker

execCommand(string, boolean, string)

警告

现已弃用此 API。

MDN Reference

该方法 execCommand 实现多个不同的命令。

function execCommand(commandId: string, showUI?: boolean, value?: string): boolean

参数

commandId

string

showUI

boolean

value

string

返回

boolean

exitFullscreen()

Document 方法 exitFullscreen() 请求此文档中当前以全屏模式呈现的元素已退出全屏模式,从而还原屏幕的上一个状态。

MDN 参考

function exitFullscreen(): Promise<void>

返回

Promise<void>

exitPictureInPicture()

exitPictureInPicture()文档界面的方法要求将当前浮动的本文档中包含的视频从图片中模式中取出,从而还原屏幕的先前状态。

MDN 参考

function exitPictureInPicture(): Promise<void>

返回

Promise<void>

exitPointerLock()

exitPointerLock() Document 接口的方法以异步方式释放以前通过 Element.requestPointerLock 请求的指针锁。

MDN 参考

function exitPointerLock()

getElementById(string)

返回其 ID 为 elementId 的节点后代中的第一个元素。

MDN 参考

function getElementById(elementId: string): HTMLElement | null

参数

elementId

string

返回

HTMLElement | null

getElementsByClassName(string)

getElementsByClassName具有所有给定类名的所有子元素的方法。

MDN 参考

function getElementsByClassName(classNames: string): HTMLCollectionOf<Element>

参数

classNames

string

返回

HTMLCollectionOf<Element>

getElementsByName(string)

getElementsByName() Document 对象的方法返回文档中具有给定name属性的元素的 NodeList 集合。

MDN 参考

function getElementsByName(elementName: string): NodeListOf<HTMLElement>

参数

elementName

string

返回

NodeListOf<HTMLElement>

getElementsByTagName(string)

function getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>

参数

qualifiedName

string

返回

HTMLCollectionOf<Element>

getElementsByTagName<K>(K)

搜索 getElementsByTagName 完整文档的方法,包括根节点。

MDN 参考

function getElementsByTagName<K>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>

参数

qualifiedName

K

返回

HTMLCollectionOf<HTMLElementTagNameMap[K]>

getElementsByTagName<K>(K)

function getElementsByTagName<K>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>

参数

qualifiedName

K

返回

HTMLCollectionOf<SVGElementTagNameMap[K]>

getElementsByTagName<K>(K)

function getElementsByTagName<K>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>

参数

qualifiedName

K

返回

HTMLCollectionOf<MathMLElementTagNameMap[K]>

getElementsByTagName<K>(K)

警告

现已弃用此 API。

function getElementsByTagName<K>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>

参数

qualifiedName

K

返回

HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>

getElementsByTagNameNS("http://www.w3.org/1998/Math/MathML", string)

function getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>

参数

namespaceURI

"http://www.w3.org/1998/Math/MathML"

localName

string

返回

HTMLCollectionOf<MathMLElement>

getElementsByTagNameNS("http://www.w3.org/1999/xhtml", string)

返回一个元素列表,其中包含属于给定命名空间的给定标记名称。

MDN 参考

function getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>

参数

namespaceURI

"http://www.w3.org/1999/xhtml"

localName

string

返回

HTMLCollectionOf<HTMLElement>

getElementsByTagNameNS("http://www.w3.org/2000/svg", string)

function getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>

参数

namespaceURI

"http://www.w3.org/2000/svg"

localName

string

返回

HTMLCollectionOf<SVGElement>

getElementsByTagNameNS(string | null, string)

function getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>

参数

namespace

string | null

localName

string

返回

HTMLCollectionOf<Element>

getSelection()

getSelection() Document 接口的方法返回与此文档关联的 Selection 对象,表示用户选择的文本范围或插入符号的当前位置。

MDN 参考

function getSelection(): Selection | null

返回

Selection | null

hasFocus()

hasFocus() Document 接口的方法返回一个布尔值,该值指示文档内的任何元素是否具有焦点。

MDN 参考

function hasFocus(): boolean

返回

boolean

hasStorageAccess()

hasStorageAccess() Document 接口的方法返回一个 Promise,该 Promise 使用布尔值解析,该值指示文档是否有权访问第三方未分区的 Cookie。

MDN 参考

function hasStorageAccess(): Promise<boolean>

返回

Promise<boolean>

importNode<T>(T, boolean | ImportNodeOptions)

Document 对象 importNode() 的方法会在以后创建插入到当前文档中的副本。

MDN 参考

function importNode<T>(node: T, options?: boolean | ImportNodeOptions): T

参数

node

T

options

boolean | ImportNodeOptions

返回

T

open(string | URL, string, string)

function open(url: string | URL, name: string, features: string): Window | null

参数

url

string | URL

name

string

features

string

返回

Window | null

open(string, string)

此方法 Document.open() 打开一个文档,该文档确实会产生一些副作用。

MDN 参考

function open(unused1?: string, unused2?: string): Document

参数

unused1

string

unused2

string

返回

queryCommandEnabled(string)

警告

现已弃用此 API。

MDN Reference

该方法 Document.queryCommandEnabled() 报告是否由浏览器启用指定的编辑器命令。

function queryCommandEnabled(commandId: string): boolean

参数

commandId

string

返回

boolean

queryCommandIndeterm(string)

警告

现已弃用此 API。

function queryCommandIndeterm(commandId: string): boolean

参数

commandId

string

返回

boolean

queryCommandState(string)

警告

现已弃用此 API。

MDN Reference

该方法 queryCommandState() 将告诉你当前所选内容是否应用了特定的 Document.execCommand() 命令。

function queryCommandState(commandId: string): boolean

参数

commandId

string

返回

boolean

queryCommandSupported(string)

警告

现已弃用此 API。

MDN Reference

该方法 Document.queryCommandSupported() 报告浏览器是否支持指定的编辑器命令。

function queryCommandSupported(commandId: string): boolean

参数

commandId

string

返回

boolean

queryCommandValue(string)

警告

现已弃用此 API。

function queryCommandValue(commandId: string): string

参数

commandId

string

返回

string

releaseEvents()

警告

现已弃用此 API。

function releaseEvents()

removeEventListener(string, EventListenerOrEventListenerObject, boolean | EventListenerOptions)

function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions)

参数

type

string

listener

EventListenerOrEventListenerObject

options

boolean | EventListenerOptions

removeEventListener<K>(K, (this: Document, ev: DocumentEventMap[K]) => any, boolean | EventListenerOptions)

removeEventListener() EventTarget 接口的方法从目标中删除以前向 EventTarget.addEventListener() 注册的事件侦听器。

MDN 参考

function removeEventListener<K>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions)

参数

type

K

listener

(this: Document, ev: DocumentEventMap[K]) => any

options

boolean | EventListenerOptions

requestStorageAccess()

requestStorageAccess() Document 接口的方法允许第三方上下文(即嵌入在 iframe 中)中加载的内容请求访问第三方 Cookie 和未分区状态。

MDN 参考

function requestStorageAccess(): Promise<void>

返回

Promise<void>

startViewTransition(ViewTransitionUpdateCallback | StartViewTransitionOptions)

startViewTransition() Document 接口的方法启动新的同一文档(SPA)视图转换,并返回一个 ViewTransition 对象来表示它。

MDN 参考

function startViewTransition(callbackOptions?: ViewTransitionUpdateCallback | StartViewTransitionOptions): ViewTransition

参数

callbackOptions

ViewTransitionUpdateCallback | StartViewTransitionOptions

返回

ViewTransition

write(string[])

警告

现已弃用此 API。

MDN Reference

write() Document 接口的方法将一个或多个 TrustedHTML 或字符串参数中的文本写入 document.open 打开的文档流。

function write(text: string[])

参数

text

string[]

writeln(string[])

writeln() Document 接口的方法将一个或多个 TrustedHTML 或字符串参数中的文本写入 document stream,该流由 document.open()打开,后跟换行符。

MDN 参考

function writeln(text: string[])

参数

text

string[]

继承的方法详细信息

append((string | Node)[])

在节点的最后一个子级之后插入节点,同时将节点中的字符串替换为等效的文本节点。

如果违反节点树的约束,则引发“HierarchyRequestError”DOMException。

MDN 参考

function append(nodes: (string | Node)[])

参数

nodes

(string | Node)[]

继承自 ParentNode.append

appendChild<T>(T)

appendChild() Node 接口的方法将节点添加到指定父节点的子节点列表的末尾。

MDN 参考

function appendChild<T>(node: T): T

参数

node

T

返回

T

继承自 Node.appendChild

cloneNode(boolean)

Node cloneNode() 接口的方法返回调用此方法的节点的副本。

MDN 参考

function cloneNode(subtree?: boolean): Node

参数

subtree

boolean

返回

Node

继承自 Node.cloneNode

compareDocumentPosition(Node)

Node compareDocumentPosition() 接口的方法报告其自变量节点相对于调用它的节点的位置。

MDN 参考

function compareDocumentPosition(other: Node): number

参数

other

Node

返回

number

继承自 Node.compareDocumentPosition

contains(Node | null)

contains() Node 接口的方法返回一个布尔值,该值指示节点是否是给定节点的后代,即节点本身、其直接子级之一(Node.childNodes)、子级的直接子级之一等。

MDN 参考

function contains(other: Node | null): boolean

参数

other

Node | null

返回

boolean

继承自 Node.contains

createExpression(string, XPathNSResolver | null)

MDN 参考

function createExpression(expression: string, resolver?: XPathNSResolver | null): XPathExpression

参数

expression

string

resolver

XPathNSResolver | null

返回

XPathExpression

继承自 XPathEvaluatorBase.createExpression

createNSResolver(Node)

警告

现已弃用此 API。

MDN Reference

function createNSResolver(nodeResolver: Node): Node

参数

nodeResolver

Node

返回

Node

继承自 XPathEvaluatorBase.createNSResolver

dispatchEvent(Event)

dispatchEvent() EventTarget 的方法按适当的顺序将事件发送到对象(同步)调用受影响的事件侦听器。

MDN 参考

function dispatchEvent(event: Event): boolean

参数

event

Event

返回

boolean

继承自 Node.dispatchEvent

elementFromPoint(number, number)

function elementFromPoint(x: number, y: number): Element | null

参数

x

number

y

number

返回

Element | null

继承自 DocumentOrShadowRoot.elementFromPoint

elementsFromPoint(number, number)

function elementsFromPoint(x: number, y: number): Element[]

参数

x

number

y

number

返回

Element[]

继承自 DocumentOrShadowRoot.elementsFromPoint

evaluate(string, Node, XPathNSResolver | null, number, XPathResult | null)

MDN 参考

function evaluate(expression: string, contextNode: Node, resolver?: XPathNSResolver | null, type?: number, result?: XPathResult | null): XPathResult

参数

expression

string

contextNode

Node

resolver

XPathNSResolver | null

type

number

result

XPathResult | null

返回

XPathResult

继承自 XPathEvaluatorBase.evaluate

getAnimations()

MDN 参考

function getAnimations(): Animation[]

返回

Animation[]

继承自 DocumentOrShadowRoot.getAnimations

getRootNode(GetRootNodeOptions)

getRootNode() Node 接口的方法返回上下文对象的根,该根(可选)包括影子根(如果可用)。

MDN 参考

function getRootNode(options?: GetRootNodeOptions): Node

参数

options

GetRootNodeOptions

返回

Node

继承自 Node.getRootNode

hasChildNodes()

Node hasChildNodes() 接口的方法返回一个布尔值,该值指示给定节点是否具有子节点。

MDN 参考

function hasChildNodes(): boolean

返回

boolean

继承自 Node.hasChildNodes

insertBefore<T>(T, Node | null)

Node insertBefore() 接口的方法在 引用节点 之前插入节点作为指定 父节点的子节点。

MDN 参考

function insertBefore<T>(node: T, child: Node | null): T

参数

node

T

child

Node | null

返回

T

继承自 Node.insertBefore

isDefaultNamespace(string | null)

isDefaultNamespace() Node 接口的方法接受命名空间 URI 作为参数。

MDN 参考

function isDefaultNamespace(namespace: string | null): boolean

参数

namespace

string | null

返回

boolean

继承自 Node.isDefaultNamespace

isEqualNode(Node | null)

isEqualNode() Node 接口的方法测试两个节点是否相等。

MDN 参考

function isEqualNode(otherNode: Node | null): boolean

参数

otherNode

Node | null

返回

boolean

继承自 Node.isEqualNode

isSameNode(Node | null)

Node isSameNode() 接口的方法是严格相等运算符的 === 旧别名。

MDN 参考

function isSameNode(otherNode: Node | null): boolean

参数

otherNode

Node | null

返回

boolean

继承自 Node.isSameNode

lookupNamespaceURI(string | null)

Node lookupNamespaceURI() 接口的方法采用前缀作为参数,并返回与给定节点上关联的命名空间 URI(如果 null 找不到)。

MDN 参考

function lookupNamespaceURI(prefix: string | null): string | null

参数

prefix

string | null

返回

string | null

继承自 Node.lookupNamespaceURI

lookupPrefix(string | null)

Node lookupPrefix() 接口的方法返回一个字符串,其中包含给定命名空间 URI 的前缀(如果存在)以及 null 不存在的字符串。

MDN 参考

function lookupPrefix(namespace: string | null): string | null

参数

namespace

string | null

返回

string | null

继承自 Node.lookupPrefix

normalize()

Node normalize() 接口的方法将指定节点及其所有子树都放入 规范化 形式。

MDN 参考

function normalize()

继承自 Node.normalize

prepend((string | Node)[])

在节点的第一个子级之前插入节点,同时将节点中的字符串替换为等效的文本节点。

如果违反节点树的约束,则引发“HierarchyRequestError”DOMException。

MDN 参考

function prepend(nodes: (string | Node)[])

参数

nodes

(string | Node)[]

继承自 ParentNode.prepend

querySelector<E>(string)

function querySelector<E>(selectors: string): E | null

参数

selectors

string

返回

E | null

继承自 ParentNode.querySelector

querySelector<K>(K)

返回与选择器匹配的节点后代的第一个元素。

MDN 参考

function querySelector<K>(selectors: K): HTMLElementTagNameMap[K] | null

参数

selectors

K

返回

HTMLElementTagNameMap[K] | null

继承自 ParentNode.querySelector

querySelector<K>(K)

function querySelector<K>(selectors: K): SVGElementTagNameMap[K] | null

参数

selectors

K

返回

SVGElementTagNameMap[K] | null

继承自 ParentNode.querySelector

querySelector<K>(K)

function querySelector<K>(selectors: K): MathMLElementTagNameMap[K] | null

参数

selectors

K

返回

MathMLElementTagNameMap[K] | null

继承自 ParentNode.querySelector

querySelector<K>(K)

警告

现已弃用此 API。

function querySelector<K>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null

参数

selectors

K

返回

HTMLElementDeprecatedTagNameMap[K] | null

继承自 ParentNode.querySelector

querySelectorAll<E>(string)

function querySelectorAll<E>(selectors: string): NodeListOf<E>

参数

selectors

string

返回

NodeListOf<E>

继承自 ParentNode.querySelectorAll

querySelectorAll<K>(K)

返回与选择器匹配的节点的所有元素后代。

MDN 参考

function querySelectorAll<K>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>

参数

selectors

K

返回

NodeListOf<HTMLElementTagNameMap[K]>

继承自 ParentNode.querySelectorAll

querySelectorAll<K>(K)

function querySelectorAll<K>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>

参数

selectors

K

返回

NodeListOf<SVGElementTagNameMap[K]>

继承自 ParentNode.querySelectorAll

querySelectorAll<K>(K)

function querySelectorAll<K>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>

参数

selectors

K

返回

NodeListOf<MathMLElementTagNameMap[K]>

继承自 ParentNode.querySelectorAll

querySelectorAll<K>(K)

警告

现已弃用此 API。

function querySelectorAll<K>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>

参数

selectors

K

返回

NodeListOf<HTMLElementDeprecatedTagNameMap[K]>

继承自 ParentNode.querySelectorAll

removeChild<T>(T)

removeChild() Node 接口的方法从 DOM 中删除子节点,并返回已删除的节点。

MDN 参考

function removeChild<T>(child: T): T

参数

child

T

返回

T

继承自 Node.removeChild

replaceChild<T>(Node, T)

replaceChild() Node 接口的方法替换给定(父)节点中的子节点。

MDN 参考

function replaceChild<T>(node: Node, child: T): T

参数

node

Node

child

T

返回

T

继承自 Node.replaceChild

replaceChildren((string | Node)[])

将节点的所有子级替换为节点,同时将节点中的字符串替换为等效的文本节点。

如果违反节点树的约束,则引发“HierarchyRequestError”DOMException。

MDN 参考

function replaceChildren(nodes: (string | Node)[])

参数

nodes

(string | Node)[]

继承自 ParentNode.replaceChildren