プログラミング/riot.js のバックアップ(No.2)

更新


公開メモ

イベントハンドラでの e.target

http://riotjs.com/ja/guide/#イベントハンドラ

では、

- e.currentTarget は、イベントハンドラが指定された要素を指します

- e.targetはイベントの送信元エレメントです。これは必ずしも必要ではなく、currentTarget と同じです。

と書かれているのだけれど、

e.currentTarget がイベントハンドラが指定された要素であるのに対して、
e.target はイベントが発生した要素になることがあるようでした。

http://jsbin.com/tiqoyehaco/edit?html,output

こちらの黄色い枠の上へマウスカーソルを持って行くと
e.target が A 要素なのに対して
e.currentTarget が DIV 要素になることが分かります。

で、確かめてみると英語の説明は

- e.currentTarget points to the element where the event handler is specified.

- e.target is the originating element. This is not necessarily the same as currentTarget.

で、e.target の説明を日本語にする際に誤訳していたことが分かりました。

修正を PR しました。
https://github.com/riot/riot.github.io/pull/191


Counter: 2176 (from 2010/06/03), today: 1, yesterday: 0