* 仕様書

[REFS[
- [4] '''[CITE@en-US[DOM Standard]] ([TIME[2013-04-26 20:00:45 +09:00]] 版) <http://dom.spec.whatwg.org/#dom-event-istrusted>'''
- [3] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2013-04-30 04:07:36 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#concept-events-trusted>
]REFS]

* 意味

[5] [CODE(DOMa)@en[[[isTrusted]]]] が[[真]]の[[イベント]]を[DFN[[RUBYB[[[信用済みイベント]]]@en[trusted event]]]]といいます [SRC[>>3]]。

[28] 現在となっては [[trusted]] か否かはそれほど有用な概念ではないと考えられています。

;; [32] [[Webブラウザー]]自体の実装の一部を構成する[[束縛]]や、
[[ブラウザー拡張]]の類は、
[[利用者]]の行動による[[イベント]]と[[著者]]の指示による[[イベント]]の区別が必要なときにこれを使うことができます。

* 関連

[27] [[ポップアップ抑制]]されるかどうか [CODE[isTrusted]] で判定できるという[[デマ]]が流れているようですが、
[[ポップアップ]]が認められるかの条件は [[triggered by user activation]] 
であり、 [CODE[isTrusted]] はそのいくつかある要件の1つでしかありません。

* 歴史

** 誕生

[23] 元々、[[利用者エージェント]]の機能の一部を [[XBL]] として実装する時に、
[[利用者エージェント]]の[[イベント]]と[[著者]]の[[イベント]]とを区別する必要があるとして
[[trusted]] の概念が追加されました。

[29] 一時期の [[DOM]] の構想上のアーキテクチャでは、
[[利用者]]の入力 ([[マウス]]や[[キーボード]]の操作など)
は[[DOMイベント]]となり、
まずは[[著者]]のコードによって処理され、
そこで[[取り消し]]されなければ[[既定動作]]であるところの[[DOM実装]]のコードによって処理される、
ということになっていました。[[著者]]のコードも[[DOM実装]] ([[Webブラウザー]])
のコードも等しく[[イベントリスナー]]ですが、違ったグループに属していました。
[[DOM実装]]の[[イベントリスナー]]は、 [[C++]] で内部的に実装されている (とみなす)
こともあれば、 [[XBL]] のように [[JavaScript]] で実装されることも考えられました。

[30] この処理モデルでは、[[著者]]による[[Webブラウザー]]機能の濫用
(による[[利用者]]の混乱) を防ぐため、場合によっては[[著者]]の生成した[[イベント]]と、
[[利用者]]の操作による[[イベント]]とを [[DOM実装]]のコードの側で区別する必要が生じます。

[8] 最初 [[XBL2]] で [CODE(DOMi)@en[[[Event]]]] [[オブジェクト]]が[[実装]]するべき[[インターフェイス]]
[DFN[[CODE(DOMi)@en[[[EventXBL]]]]]] の[[IDL属性]] [DFN[[CODE(DOMa)@en[[[trusted]]]]]]
として規定されました。

[REFS[
-[7] [CITE@en-US-x-Hixie[XML Binding Language 2.0]]
( ([TIME[2012-06-07 23:10:04 +09:00]] 版))
<http://www-archive.mozilla.org/projects/xbl/xbl2.html#the-eventxbl>
-[6] [CITE@en-US[XBL 2.0]]
( ([TIME[2012-05-03 02:23:03 +09:00]] 版))
<http://dev.w3.org/2006/xbl2/Overview.html#the-eventxbl-interface>
- [19] [CITE@en['''['''XBL''']''' EventXBL (was: Fwd: Re: [DOM3EV] introduce Event.trusted? (ISSUE-10))]] ([[Anne van Kesteren]]著, [TIME[2007-01-12 03:55:03 +09:00]]) <https://lists.w3.org/Archives/Public/public-appformats/2007Jan/0202.html>
- [10] [CITE@en-US[XML Binding Language (XBL) 2.0]]
( ([TIME[2007-03-16 22:20:16 +09:00]] 版))
<http://www.w3.org/TR/2007/CR-xbl-20070316/#trusted>
- [11] [CITE@en-US[XML Binding Language (XBL) 2.0]]
( ([TIME[2007-03-16 22:20:16 +09:00]] 版))
<http://www.w3.org/TR/2007/CR-xbl-20070316/#the-eventxbl>
- [12] [CITE@en-US[XML Binding Language (XBL) 2.0]]
( ([TIME[2007-03-16 22:20:16 +09:00]] 版))
<http://www.w3.org/TR/2007/CR-xbl-20070316/#trusted0>
- [20] [CITE@en[trusted property]] ([[Hallvord R. M. Steen]]著, [TIME[2010-03-04 00:30:26 +09:00]]) <https://lists.w3.org/Archives/Public/www-dom/2010JanMar/0069.html>
- [21] [CITE@en[Re: ISSUE-126 (isTrusted): Consider changing 'trusted' to 'isTrusted' '''['''DOM3 Events''']''']] ([[Doug Schepers]]著, [TIME[2010-10-07 03:20:55 +09:00]]) <https://lists.w3.org/Archives/Public/www-dom/2010OctDec/0025.html>
]REFS]

[22] [CODE(DOMm)@en[trusted]] から [CODE(DOMm)@en[isTrusted]] に改称されました。

[REFS[
-[1] [CITE@en[Web Applications 1.0 r7437     Define when events are trusted and when they're not. Hopefully I got all the places that create and dispatch events...]]
( ([TIME[2012-10-07 03:04:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7436&to=7437>
-[2] [CITE[Add ''''''[''''''Unforgeable'''''']'''''' to isTrusted. · 559d925 · whatwg/dom]]
( ([TIME[2013-04-04 09:12:21 +09:00]] 版))
<https://github.com/whatwg/dom/commit/559d92560a94b5bebc3fdc9f037f971af7e9beb5>
]REFS]

[9] [CITE@en-US[Document Object Model (DOM) Level 3 Events Specification]]
( ([TIME[2012-10-25 23:58:38 +09:00]] 版))
<http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-event-type-isTrusted>

[13] [CITE@en[Bug 25504 – isTrusted in the events generated by the methods]]
( ([TIME[2014-08-27 03:05:13 +09:00]] 版))
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=25504>

[24] [[Gecko]] は独自の [CODE(DOMm)@en[addEventListener]]
の引数で、 [[trusted]] でない[[イベント]]も受信するかどうかを選べるようにしていました。

** 整理

[31] [[既定動作]]ベースの実装モデルはその後否定されることになりました。
[[trusted]] の概念の意義も失われ、挙動が曖昧なケースも生じていました。
それらの定義は[TIME[2016年][year:2016]]に整理されました。

[14] [CITE@en[Editorial: major cleanup around firing and dispatching events]]
([[annevk]]著, [TIME[2016-10-19 01:00:43 +09:00]])
<https://github.com/whatwg/html/commit/8ffbd146d4709057e45dd6cfc81e7a70897050c5>

[15] [CITE@en[Analyze isTrusted usage · Issue #1912 · whatwg/html]]
([TIME[2016-10-23 15:24:27 +09:00]])
<https://github.com/whatwg/html/issues/1912>

[16] [CITE@en[Set some MessageEvent's isTrusted attributes to true]]
([[domenic]]著, [TIME[2016-10-26 02:33:24 +09:00]])
<https://github.com/whatwg/html/commit/eecea4bf565a442e98c2ec98bf298d082d196282>

[17] [CITE@en[Always leave isTrusted as true when firing events]]
([[annevk]]著, [TIME[2016-11-17 01:18:27 +09:00]])
<https://github.com/whatwg/html/commit/e64078e9dbe871f1316a49c5d16ddacb199d7c1e>

[18] [CITE@en[Clarify isTrusted]]
([[annevk]]著, [TIME[2016-11-17 23:18:55 +09:00]])
<https://github.com/whatwg/dom/commit/7958b2557d50d5224e089b9c4c66f46782b72157>

[25] [CITE@en[Fallback to legacy type only when event is trusted]]
([[upsuper]]著, [TIME[2017-02-08 17:29:16 +09:00]])
<https://github.com/whatwg/dom/commit/9d8e4ed93896c50b1cacfceca6f93c56337686d8>

[26] [CITE@en[Set isTrusted for coalesced events (#189)]]
([[NavidZ]]著, [TIME[2017-03-23 04:17:06 +09:00]])
<https://github.com/w3c/pointerevents/commit/2fafb0ae2cca56f61382ef75f6e2f3a19d595606>