Document interface

介面代表 Document 瀏覽器中載入的任何網頁,並作為進入網頁內容的入口,該內容即 DOM 樹。

MDN 參考

Extends

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

屬性

alinkColor

回傳或設定文件主體中活躍連結的顏色。

all

文件介面的唯讀 all 屬性會回傳一個根於文件節點的 HTMLAllCollection。

anchors

An anchors HTMLCollection 的唯讀特性。

applets

applets文件的屬性會回傳一個空的 HTMLCollection。

bgColor

棄用屬性會 bgColor 取得或設定當前文件的背景顏色。

body

若不存在此類元素,則Document.body該性質代表 。null

MDN 參考

characterSet

Document.characterSet唯讀屬性會回傳目前渲染文件的字元編碼。

MDN 參考

charset
compatMode

Document.compatMode唯讀特性表示文件是在 Quirks 模式還是標準模式中呈現。

MDN 參考

contentType

Document.contentType唯讀屬性會回傳文件所呈現的 MIME 類型。

MDN 參考

cookie

文件屬性 cookie 允許你閱讀和寫出與該文件相關的 Cookie。

MDN 參考

currentScript

該 Document.currentScript 屬性回傳的是目前正在處理的腳本元素,且該元素並非 JavaScript 模組。

MDN 參考

defaultView

在瀏覽器中,回 document.defaultView 傳此屬性為唯讀。

MDN 參考

designMode

document.designMode 控制整份文件是否可編輯。

MDN 參考

dir

屬性是 Document.dir 一串字串,代表文件文本的方向性,無論是從左到右(預設)還是從右到左。

MDN 參考

doctype

doctype文件介面的唯讀屬性是一個 DocumentType 物件,代表與目前文件相關的 Doctype。

MDN 參考

documentElement

documentElement文件介面的唯讀屬性會回傳範例,即 HTML 文件的 HTML 元素。

MDN 參考

documentURI

A 字串的 documentURI 唯讀特性。

MDN 參考

domain

domain文件介面的特性會取得/設定當前文件來源的網域部分,這與同源政策相同。

embeds

An embeds HTMLCollection 的唯讀特性。

MDN 參考

fgColor

fgColor 取得/設定當前文件的前景色或文字色。

forms

forms文件介面的唯讀屬性會回傳一個 HTMLCollection,列出文件中所有表單元素。

MDN 參考

fragmentDirective

fragmentDirective文件介面的唯讀特性會回傳當前文件的 FragmentDirective。

MDN 參考

fullscreen

過時的文件介面的 fullscreen 唯讀特性會報告文件是否目前以全螢幕模式顯示內容。

fullscreenEnabled

文件介面上的唯讀 fullscreenEnabled 屬性會顯示是否支援全螢幕模式。

MDN 參考

head

head文件介面的唯讀特性會回傳目前文件的主元素。

MDN 參考

hidden

唯讀屬性會 Document.hidden 回傳一個布林值,指示該頁面是否被視為隱藏。

MDN 參考

images

文件介面的 images 唯讀特性會回傳目前 HTML 文件中的一組影像。

MDN 參考

implementation

該屬性回 Document.implementation 傳一個 DOMImplementation 物件。

MDN 參考

inputEncoding
lastModified

lastModified文件介面的屬性會回傳一個字串,包含目前文件最後修改的日期與當地時間。

MDN 參考

linkColor

這個 Document.linkColor 屬性會取得/設定文件內連結的顏色。

links

links文件介面的唯讀特性會回傳所有區域元素的集合,以及文件中帶有 href 屬性值的元素。

MDN 參考

location

Document.location唯讀屬性會回傳 a,並提供更改該 URL 及載入其他 URL 的方法。

MDN 參考

mozCancelFullScreen
msExitFullscreen
onfullscreenchange

MDN 參考

onfullscreenerror

MDN 參考

onpointerlockchange

MDN 參考

onpointerlockerror

MDN 參考

onreadystatechange

MDN 參考

onvisibilitychange

MDN 參考

ownerDocument

節點介面的唯讀 ownerDocument 特性會回傳該節點的頂層文件物件。

MDN 參考

pictureInPictureEnabled

可用 的唯讀 pictureInPictureEnabled 屬性。

MDN 參考

plugins

僅讀屬性, plugins 包含一個或多個代表 An HTMLCollection 的 HTMLEmbedElements。

MDN 參考

readyState

該 Document.readyState 屬性描述文件的載入狀態。

MDN 參考

referrer

該 Document.referrer 屬性會回傳連結至此頁面的頁面的 URI。

MDN 參考

rootElement

Document.rootElement 如果該元素是文件,則回傳該文件的根元素。

scripts

scripts文件介面的屬性會回傳文件中腳本元素的清單。

MDN 參考

scrollingElement

scrollingElement卷軸的唯讀特性。

MDN 參考

textContent

MDN 參考

timeline

timeline文件介面的可讀特性代表目前文件的預設時間軸。

MDN 參考

title

屬性 document.title 取得或設定文件目前的標題。

MDN 參考

URL

文件介面的 URL 唯讀特性會以字串形式回傳文件位置。

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

節點介面的唯 baseURI 讀特性會回傳包含該節點的文件的絕對基底 URL。

MDN 參考

CDATA_SECTION_NODE

node 是 CDATASection 節點。

childElementCount

MDN 參考

childNodes

節點介面的唯 childNodes 讀特性會回傳一個活著的子節點,第一個子節點被指派索引 0。

MDN 參考

children

傳回子專案。

MDN 參考

COMMENT_NODE

node 是批注節點。

DOCUMENT_FRAGMENT_NODE

node 是 DocumentFragment 節點。

DOCUMENT_NODE

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

節點介面的唯 firstChild 讀特性會回傳該節點在樹中的第一個子節點,或 null 如果節點沒有子節點。

MDN 參考

firstElementChild

傳回專案的第一個子系,否則傳回 null。

MDN 參考

fonts

MDN 參考

fullscreenElement

會傳回檔的全屏幕專案。

MDN 參考

isConnected

Node 介面的唯 isConnected 讀特性會回傳一個布林值,指示該節點是否直接或間接連接到文件物件。

MDN 參考

lastChild

節點介面的唯 lastChild 讀特性會回傳該節點的最後一個子節點,或 null 如果沒有子節點。

MDN 參考

lastElementChild

傳回項目的最後一個子系,否則傳回 null。

MDN 參考

nextSibling

Node 介面的唯 nextSibling 讀特性會回傳父節點 Node.childNodes 中緊接指定節點的節點,或若指定節點是父元素的最後一個子節點,則回傳 null 該節點。

MDN 參考

nodeName

Node 的唯讀 nodeName 特性會以字串形式回傳當前節點的名稱。

MDN 參考

nodeType

節點介面的唯 nodeType 讀特性是一個整數,用來識別節點的本質。

MDN 參考

nodeValue

nodeValue節點介面的特性會回傳或設定目前節點的值。

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

節點介面的唯 parentNode 讀特性會回傳指定節點在 DOM 樹中的父節點。

MDN 參考

pictureInPictureElement

MDN 參考

pointerLockElement

MDN 參考

previousSibling

節點介面的唯 previousSibling 讀特性會回傳其父節點中緊鄰指定的節點,或 null 若該指定節點是該清單中的第一個節點。

MDN 參考

PROCESSING_INSTRUCTION_NODE

node 是 ProcessingInstruction 節點。

styleSheets

MDN 參考

TEXT_NODE

node 是 Text 節點。

方法

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()文件介面的方法會回傳一個 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()

建立一個新的空文件片段,可加入 DOM 節點以建立螢幕外的 DOM 樹。

MDN 參考

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

在 HTML 文件中,該 document.createElement() 方法會建立由 所 localName指定的 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()

文件方法 exitFullscreen() 要求將目前以全螢幕模式呈現的該文件元素從全螢幕模式中移除,恢復螢幕先前的狀態。

MDN 參考

exitPictureInPicture()

exitPictureInPicture()文件介面的方法要求將本文件中目前漂浮的影片從畫中畫模式中移除,恢復螢幕先前的狀態。

MDN 參考

exitPointerLock()

文件介面的方法會 exitPointerLock() 非同步釋放先前透過 Element.requestPointerLock 請求的指標鎖定。

MDN 參考

getElementById(string)

回傳節點後代中第一個 ID 為 elementId(元素)的元素。

MDN 參考

getElementsByClassName(string)

對 getElementsByClassName 所有具有所有給定類別名稱的子元素的方法。

MDN 參考

getElementsByName(string)

getElementsByName()文件物件的方法會回傳一個包含具有特定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()文件介面的方法會回傳與此文件相關的 Selection 物件,代表使用者所選擇的文字範圍,或是插入符號目前的位置。

MDN 參考

hasFocus()

hasFocus()文件介面的方法會回傳一個布林值,表示文件本身或文件中的任何元素是否有焦點。

MDN 參考

hasStorageAccess()

hasStorageAccess()文件介面的方法會回傳一個 Promise,該承諾以布林值解析,表示文件是否能存取第三方未分割的 Cookie。

MDN 參考

importNode<T>(T, boolean | ImportNodeOptions)

文件物件的方法會 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()文件介面的方法允許載入於第三方情境(即嵌入 iframe)的內容,請求存取第三方 Cookie 及未分割狀態。

MDN 參考

startViewTransition(ViewTransitionUpdateCallback | StartViewTransitionOptions)

startViewTransition()文件介面的方法會啟動一個新的同文件(SPA)視圖轉換,並回傳一個 ViewTransition 物件來表示該視圖。

MDN 參考

write(string[])

write()文件介面的方法以一個或多個 TrustedHTML 或字串參數寫入由 document.open() 開啟的文件串流。

writeln(string[])

writeln()文件介面的方法以一個或多個 TrustedHTML 或字串參數寫入由 document.open() 開啟的文件串流,後接換行字元。

MDN 參考

繼承的方法

append((string | Node)[])

在節點的最後一個子系之後插入節點,同時以對等的 Text 節點取代節點中的字串。

如果違反節點樹狀結構的條件約束,則會擲回 “HierarchyRequestError” DOMException。

MDN 參考

appendChild<T>(T)

appendChild()節點介面的方法將節點加入指定父節點子節點清單的末尾。

MDN 參考

cloneNode(boolean)

cloneNode()節點介面的方法會回傳該方法所呼叫的節點的副本。

MDN 參考

compareDocumentPosition(Node)

compareDocumentPosition()節點介面的方法會回報其參數節點相對於被呼叫節點的位置。

MDN 參考

contains(Node | null)

contains()節點介面的方法回傳一個布林值,表示節點是否為特定節點的後代,即該節點本身、其直接子節點之一(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()

hasChildNodes()節點介面的方法會回傳一個布林值,指示該節點是否有子節點。

MDN 參考

insertBefore<T>(T, Node | null)

insertBefore()節點介面的方法是將節點插入於參考節點之前,作為指定父節點的子節點。

MDN 參考

isDefaultNamespace(string | null)

isDefaultNamespace() Node 介面的方法接受命名空間 URI 作為參數。

MDN 參考

isEqualNode(Node | null)

isEqualNode()節點介面的方法測試兩個節點是否相等。

MDN 參考

isSameNode(Node | null)

isSameNode()節點介面的方法是一個傳統別名,用於嚴格===等號運算子。

MDN 參考

lookupNamespaceURI(string | null)

lookupNamespaceURI()節點介面的方法以前綴為參數,並在找到時回傳該節點對應的命名空間 URI(null若未找到則回傳)。

MDN 參考

lookupPrefix(string | null)

lookupPrefix() Node 介面的方法會回傳包含指定命名空間 URI 前綴的字串(若有null),若無則回傳。

MDN 參考

normalize()

normalize()節點介面的方法將指定的節點及其所有子樹置於正規化形式。

MDN 參考

prepend((string | Node)[])

在節點的第一個子系之前插入節點,同時以對等的 Text 節點取代節點中的字串。

如果違反節點樹狀結構的條件約束,則會擲回 “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()節點介面的方法會從 DOM 中移除一個子節點,並回傳被移除的節點。

MDN 參考

replaceChild<T>(Node, T)

replaceChild()節點介面的方法會替換給定(父)節點中的子節點。

MDN 參考

replaceChildren((string | Node)[])

將節點的所有子系取代為節點,同時以對等的 Text 節點取代節點中的字串。

如果違反節點樹狀結構的條件約束,則會擲回 “HierarchyRequestError” DOMException。

MDN 參考

屬性詳細資料

alinkColor

警告

此 API 現已淘汰。

MDN Reference

回傳或設定文件主體中活躍連結的顏色。

alinkColor: string

屬性值

string

all

警告

此 API 現已淘汰。

MDN Reference

文件介面的唯讀 all 屬性會回傳一個根於文件節點的 HTMLAllCollection。

all: HTMLAllCollection

屬性值

HTMLAllCollection

anchors

警告

此 API 現已淘汰。

MDN Reference

An anchors HTMLCollection 的唯讀特性。

anchors: HTMLCollectionOf<HTMLAnchorElement>

屬性值

HTMLCollectionOf<HTMLAnchorElement>

applets

警告

此 API 現已淘汰。

MDN Reference

applets文件的屬性會回傳一個空的 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

文件屬性 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文件介面的唯讀屬性是一個 DocumentType 物件,代表與目前文件相關的 Doctype。

MDN 參考

doctype: DocumentType | null

屬性值

DocumentType | null

documentElement

documentElement文件介面的唯讀屬性會回傳範例,即 HTML 文件的 HTML 元素。

MDN 參考

documentElement: HTMLElement

屬性值

HTMLElement

documentURI

A 字串的 documentURI 唯讀特性。

MDN 參考

documentURI: string

屬性值

string

domain

警告

此 API 現已淘汰。

MDN Reference

domain文件介面的特性會取得/設定當前文件來源的網域部分,這與同源政策相同。

domain: string

屬性值

string

embeds

An embeds HTMLCollection 的唯讀特性。

MDN 參考

embeds: HTMLCollectionOf<HTMLEmbedElement>

屬性值

HTMLCollectionOf<HTMLEmbedElement>

fgColor

警告

此 API 現已淘汰。

MDN Reference

fgColor 取得/設定當前文件的前景色或文字色。

fgColor: string

屬性值

string

forms

forms文件介面的唯讀屬性會回傳一個 HTMLCollection,列出文件中所有表單元素。

MDN 參考

forms: HTMLCollectionOf<HTMLFormElement>

屬性值

HTMLCollectionOf<HTMLFormElement>

fragmentDirective

fragmentDirective文件介面的唯讀特性會回傳當前文件的 FragmentDirective。

MDN 參考

fragmentDirective: FragmentDirective

屬性值

FragmentDirective

fullscreen

警告

此 API 現已淘汰。

MDN Reference

過時的文件介面的 fullscreen 唯讀特性會報告文件是否目前以全螢幕模式顯示內容。

fullscreen: boolean

屬性值

boolean

fullscreenEnabled

文件介面上的唯讀 fullscreenEnabled 屬性會顯示是否支援全螢幕模式。

MDN 參考

fullscreenEnabled: boolean

屬性值

boolean

head

head文件介面的唯讀特性會回傳目前文件的主元素。

MDN 參考

head: HTMLHeadElement

屬性值

HTMLHeadElement

hidden

唯讀屬性會 Document.hidden 回傳一個布林值,指示該頁面是否被視為隱藏。

MDN 參考

hidden: boolean

屬性值

boolean

images

文件介面的 images 唯讀特性會回傳目前 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文件介面的屬性會回傳一個字串,包含目前文件最後修改的日期與當地時間。

MDN 參考

lastModified: string

屬性值

string

linkColor

警告

此 API 現已淘汰。

MDN Reference

這個 Document.linkColor 屬性會取得/設定文件內連結的顏色。

linkColor: string

屬性值

string

links文件介面的唯讀特性會回傳所有區域元素的集合,以及文件中帶有 href 屬性值的元素。

MDN 參考

links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>

屬性值

HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>

location

Document.location唯讀屬性會回傳 a,並提供更改該 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

節點介面的唯讀 ownerDocument 特性會回傳該節點的頂層文件物件。

MDN 參考

ownerDocument: null

屬性值

null

pictureInPictureEnabled

可用 的唯讀 pictureInPictureEnabled 屬性。

MDN 參考

pictureInPictureEnabled: boolean

屬性值

boolean

plugins

僅讀屬性, plugins 包含一個或多個代表 An 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文件介面的屬性會回傳文件中腳本元素的清單。

MDN 參考

scripts: HTMLCollectionOf<HTMLScriptElement>

屬性值

HTMLCollectionOf<HTMLScriptElement>

scrollingElement

scrollingElement卷軸的唯讀特性。

MDN 參考

scrollingElement: Element | null

屬性值

Element | null

textContent

MDN 參考

null textContent

屬性值

null

timeline

timeline文件介面的可讀特性代表目前文件的預設時間軸。

MDN 參考

timeline: DocumentTimeline

屬性值

DocumentTimeline

title

屬性 document.title 取得或設定文件目前的標題。

MDN 參考

title: string

屬性值

string

URL

文件介面的 URL 唯讀特性會以字串形式回傳文件位置。

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

節點介面的唯 baseURI 讀特性會回傳包含該節點的文件的絕對基底 URL。

MDN 參考

baseURI: string

屬性值

string

繼承自 Node.baseURI

CDATA_SECTION_NODE

node 是 CDATASection 節點。

CDATA_SECTION_NODE: 4

屬性值

4

繼承自 Node.CDATA_SECTION_NODE

childElementCount

MDN 參考

childElementCount: number

屬性值

number

繼承自 parentNode.childElementCount

childNodes

節點介面的唯 childNodes 讀特性會回傳一個活著的子節點,第一個子節點被指派索引 0。

MDN 參考

childNodes: NodeListOf<ChildNode>

屬性值

NodeListOf<ChildNode>

繼承自 Node.childNodes

children

傳回子專案。

MDN 參考

children: HTMLCollection

屬性值

HTMLCollection

繼承自 ParentNode.children

COMMENT_NODE

node 是批注節點。

COMMENT_NODE: 8

屬性值

8

繼承自 Node.COMMENT_NODE

DOCUMENT_FRAGMENT_NODE

node 是 DocumentFragment 節點。

DOCUMENT_FRAGMENT_NODE: 11

屬性值

11

繼承自 Node.DOCUMENT_FRAGMENT_NODE

DOCUMENT_NODE

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

節點介面的唯 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 讀特性會回傳一個布林值,指示該節點是否直接或間接連接到文件物件。

MDN 參考

isConnected: boolean

屬性值

boolean

繼承自 Node.isConnected

lastChild

節點介面的唯 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

節點介面的唯 nodeType 讀特性是一個整數,用來識別節點的本質。

MDN 參考

nodeType: number

屬性值

number

繼承自 Node.nodeType

nodeValue

nodeValue節點介面的特性會回傳或設定目前節點的值。

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.onprematch

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.ontoggle

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

節點介面的唯 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

節點介面的唯 previousSibling 讀特性會回傳其父節點中緊鄰指定的節點,或 null 若該指定節點是該清單中的第一個節點。

MDN 參考

previousSibling: ChildNode | null

屬性值

ChildNode | null

繼承自 Node.previousSibling

PROCESSING_INSTRUCTION_NODE

node 是 ProcessingInstruction 節點。

PROCESSING_INSTRUCTION_NODE: 7

屬性值

7

繼承自 Node.PROCESSING_INSTRUCTION_NODE

styleSheets

MDN 參考

styleSheets: StyleSheetList

屬性值

StyleSheetList

繼承自 DocumentOrShadowRoot.styleSheets

TEXT_NODE

node 是 Text 節點。

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()文件介面的方法會回傳一個 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()

建立一個新的空文件片段,可加入 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 文件中,該 document.createElement() 方法會建立由 所 localName指定的 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()

文件方法 exitFullscreen() 要求將目前以全螢幕模式呈現的該文件元素從全螢幕模式中移除,恢復螢幕先前的狀態。

MDN 參考

function exitFullscreen(): Promise<void>

傳回

Promise<void>

exitPictureInPicture()

exitPictureInPicture()文件介面的方法要求將本文件中目前漂浮的影片從畫中畫模式中移除,恢復螢幕先前的狀態。

MDN 參考

function exitPictureInPicture(): Promise<void>

傳回

Promise<void>

exitPointerLock()

文件介面的方法會 exitPointerLock() 非同步釋放先前透過 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()文件物件的方法會回傳一個包含具有特定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()文件介面的方法會回傳與此文件相關的 Selection 物件,代表使用者所選擇的文字範圍,或是插入符號目前的位置。

MDN 參考

function getSelection(): Selection | null

傳回

Selection | null

hasFocus()

hasFocus()文件介面的方法會回傳一個布林值,表示文件本身或文件中的任何元素是否有焦點。

MDN 參考

function hasFocus(): boolean

傳回

boolean

hasStorageAccess()

hasStorageAccess()文件介面的方法會回傳一個 Promise,該承諾以布林值解析,表示文件是否能存取第三方未分割的 Cookie。

MDN 參考

function hasStorageAccess(): Promise<boolean>

傳回

Promise<boolean>

importNode<T>(T, boolean | ImportNodeOptions)

文件物件的方法會 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()文件介面的方法允許載入於第三方情境(即嵌入 iframe)的內容,請求存取第三方 Cookie 及未分割狀態。

MDN 參考

function requestStorageAccess(): Promise<void>

傳回

Promise<void>

startViewTransition(ViewTransitionUpdateCallback | StartViewTransitionOptions)

startViewTransition()文件介面的方法會啟動一個新的同文件(SPA)視圖轉換,並回傳一個 ViewTransition 物件來表示該視圖。

MDN 參考

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

參數

callbackOptions

ViewTransitionUpdateCallback | StartViewTransitionOptions

傳回

ViewTransition

write(string[])

警告

此 API 現已淘汰。

MDN Reference

write()文件介面的方法以一個或多個 TrustedHTML 或字串參數寫入由 document.open() 開啟的文件串流。

function write(text: string[])

參數

text

string[]

writeln(string[])

writeln()文件介面的方法以一個或多個 TrustedHTML 或字串參數寫入由 document.open() 開啟的文件串流,後接換行字元。

MDN 參考

function writeln(text: string[])

參數

text

string[]

繼承的方法的詳細資料

append((string | Node)[])

在節點的最後一個子系之後插入節點,同時以對等的 Text 節點取代節點中的字串。

如果違反節點樹狀結構的條件約束,則會擲回 “HierarchyRequestError” DOMException。

MDN 參考

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

參數

nodes

(string | Node)[]

繼承自 parentNode.append

appendChild<T>(T)

appendChild()節點介面的方法將節點加入指定父節點子節點清單的末尾。

MDN 參考

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

參數

node

T

傳回

T

繼承自 Node.appendChild

cloneNode(boolean)

cloneNode()節點介面的方法會回傳該方法所呼叫的節點的副本。

MDN 參考

function cloneNode(subtree?: boolean): Node

參數

subtree

boolean

傳回

Node

繼承自 Node.cloneNode

compareDocumentPosition(Node)

compareDocumentPosition()節點介面的方法會回報其參數節點相對於被呼叫節點的位置。

MDN 參考

function compareDocumentPosition(other: Node): number

參數

other

Node

傳回

number

繼承自 Node.compareDocumentPosition

contains(Node | null)

contains()節點介面的方法回傳一個布林值,表示節點是否為特定節點的後代,即該節點本身、其直接子節點之一(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()

hasChildNodes()節點介面的方法會回傳一個布林值,指示該節點是否有子節點。

MDN 參考

function hasChildNodes(): boolean

傳回

boolean

繼承自 Node.hasChildNodes

insertBefore<T>(T, Node | null)

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()節點介面的方法測試兩個節點是否相等。

MDN 參考

function isEqualNode(otherNode: Node | null): boolean

參數

otherNode

Node | null

傳回

boolean

繼承自 Node.isEqualNode

isSameNode(Node | null)

isSameNode()節點介面的方法是一個傳統別名,用於嚴格===等號運算子。

MDN 參考

function isSameNode(otherNode: Node | null): boolean

參數

otherNode

Node | null

傳回

boolean

繼承自 Node.isSameNode

lookupNamespaceURI(string | null)

lookupNamespaceURI()節點介面的方法以前綴為參數,並在找到時回傳該節點對應的命名空間 URI(null若未找到則回傳)。

MDN 參考

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

參數

prefix

string | null

傳回

string | null

繼承自 Node.lookupNamespaceURI

lookupPrefix(string | null)

lookupPrefix() Node 介面的方法會回傳包含指定命名空間 URI 前綴的字串(若有null),若無則回傳。

MDN 參考

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

參數

namespace

string | null

傳回

string | null

繼承自 Node.lookupPrefix

normalize()

normalize()節點介面的方法將指定的節點及其所有子樹置於正規化形式。

MDN 參考

function normalize()

繼承自 Node.normalize

prepend((string | Node)[])

在節點的第一個子系之前插入節點,同時以對等的 Text 節點取代節點中的字串。

如果違反節點樹狀結構的條件約束,則會擲回 “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()節點介面的方法會從 DOM 中移除一個子節點,並回傳被移除的節點。

MDN 參考

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

參數

child

T

傳回

T

繼承自 Node.removeChild

replaceChild<T>(Node, T)

replaceChild()節點介面的方法會替換給定(父)節點中的子節點。

MDN 參考

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

參數

node

Node

child

T

傳回

T

繼承自 Node.replaceChild

replaceChildren((string | Node)[])

將節點的所有子系取代為節點,同時以對等的 Text 節點取代節點中的字串。

如果違反節點樹狀結構的條件約束,則會擲回 “HierarchyRequestError” DOMException。

MDN 參考

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

參數

nodes

(string | Node)[]

繼承自 ParentNode.replaceChildren