diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/event/istrusted | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/event/istrusted')
-rw-r--r-- | files/zh-cn/web/api/event/istrusted/index.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/event/istrusted/index.html b/files/zh-cn/web/api/event/istrusted/index.html new file mode 100644 index 0000000000..275d384acd --- /dev/null +++ b/files/zh-cn/web/api/event/istrusted/index.html @@ -0,0 +1,62 @@ +--- +title: Event.isTrusted +slug: Web/API/Event/isTrusted +tags: + - API + - Event + - Reference + - 只读 + - 属性 +translation_of: Web/API/Event/isTrusted +--- +<div>{{APIRef("DOM")}}</div> + +<p>{{domxref("Event")}} 接口的 <strong><code>isTrusted</code></strong> 属性是一个只读属性,它是一个布尔值({{domxref("Boolean")}})。当事件是由用户行为生成的时候,这个属性的值为 <code>true</code> ,而当事件是由脚本创建、修改、通过 {{domxref("EventTarget.dispatchEvent()")}} 派发的时候,这个属性的值为 <code>false</code> 。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var <em>eventIsTrusted</em> = <em>event</em>.isTrusted; +</pre> + +<h3 id="值">值</h3> + +<p>{{domxref("Boolean")}} (布尔值)</p> + +<h2 id="示例">示例</h2> + +<pre class="brush: js">if (e.isTrusted) { + /* Event 事件可信 */ +} else { + /* Event 事件不可信 */ +} +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">现状</th> + <th scope="col">意见</th> + </tr> + <tr> + <td>{{SpecName('DOM WHATWG', '#dom-event-istrusted', 'Event.isTrusted')}}</td> + <td>{{ Spec2('DOM WHATWG') }}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('DOM3 Events', '#trusted-events', 'Trusted events')}}</td> + <td>{{Spec2('DOM3 Events')}}</td> + <td>添加有关受信任与不受信任事件的请求,而 <code>isTrusted</code> 属性并非由其定义。</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器支持">浏览器支持</h2> + +<div> + + +<p>{{Compat("api.Event.isTrusted")}}</p> +</div> |