Should `.trigger()` more clearly indicate that it does not invoke event listeners created outside of jQuery?

オープン
#1,191 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
48/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
jquery
領域
documentation

調査の方向性

https://api.jquery.com/trigger/ の .trigger() ドキュメントから始め、.on() とショートカットメソッドでアタッチされたハンドラーについての既存の説明を確認してください。ページを更新して、これらのハンドラーと EventTarget.addEventListener() で追加されたリスナーを明確に区別し、そのうえで、文言によって dispatchEvent() との違いが明確に説明されていることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

I have been using jQuery for about 9 years, and only just today did I realize that $('#element').trigger('change'); is not equivalent to $('#element')[0].dispatchEvent(new Event('change'));.

On a careful reading of https://api.jquery.com/trigger/, it does indicate:

Any event handlers attached with .on() or one of its shortcut methods are triggered...

However, I wonder if there should be a more explicit callout that listeners for event types added via EventTarget.addEventListener() are not invoked.

I believe I had my incorrect expectation because I did not realized there was a semantic difference between a DOM EventListener and a jQuery event handler, and because I was already used to using jQuery as a sort of friendly, cross-browser interface for other Web APIs (Noting that new Event() never received support in IE, for example).

主要言語
HTML
スター
324
フォーク
259
平均マージ
1日 30分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jquery/api.jquery.com のほかの issue

jquery/api.jquery.com の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。