isTrusted
只读特性在
事件
接口是
布尔
也就是
true
when the event was generated by a user action, and
false
when the event was created or modified by a script or dispatched via
EventTarget.dispatchEvent()
.
var eventIsTrusted = event.isTrusted;
if (e.isTrusted) {
/* The event is trusted */
} else {
/* The event is not trusted */
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
DOM
The definition of 'Event.isTrusted' in that specification. |
实时标准 | |
|
DOM (文档对象模型) 3 级事件规范
The definition of 'Trusted events' in that specification. |
过时 |
Adds requirements regarding trusted and untrusted events, though it does not itself define the
isTrusted
特性。
|
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
isTrusted
|
Chrome
46
注意事项
|
Edge 12 | Firefox Yes |
IE
不支持
No
注意事项
|
Opera
33
注意事项
|
Safari 10 |
WebView Android
46
注意事项
|
Chrome Android
46
注意事项
|
Firefox Android Yes |
Opera Android
33
注意事项
|
Safari iOS 10 |
Samsung Internet Android
5.0
注意事项
|
完整支持
不支持
见实现注意事项。
事件
AbortController
AbortSignal
AbstractRange
Attr
ByteString
CDATASection
CSSPrimitiveValue
CSSValue
CSSValueList
CharacterData
ChildNode
注释
CustomEvent
DOMConfiguration
DOMError
DOMErrorHandler
DOMException
DOMImplementation
DOMImplementationList
DOMImplementationRegistry
DOMImplementationSource
DOMLocator
DOMObject
DOMParser
DOMPoint
DOMPointInit
DOMPointReadOnly
DOMRect
DOMString
DOMTimeStamp
DOMTokenList
DOMUserData
Document
DocumentFragment
DocumentType
元素
ElementTraversal
Entity
EntityReference
EventTarget
HTMLCollection
MutationObserver
节点
NodeFilter
NodeIterator
NodeList
NonDocumentTypeChildNode
ProcessingInstruction
PromiseResolver
范围
StaticRange
文本
TextDecoder
TextEncoder
TimeRanges
TreeWalker
TypeInfo
USVString
UserDataHandler
XMLDocument