2016-11-13 4 views
0

私はそれをテストしていますが、私のブラウザであるかどうかはわかりません。第3引数をオブジェクトとしてサポートしますか?addEventListener?私はonce:trueを設定したい:addEventListenerのBabelサポートは1回ですか? (3番目のオプションオブジェクト)

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

target.addEventListener(タイプ、リスナー[、オプション]);

options Optional 
    An options object that specifies characteristics about the event listener. The available options are: 

     capture: A Boolean that indicates that events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. 
     once: A Boolean indicating that the listener should be invoked at most once after being added. If it is true, the listener would be removed automatically when it is invoked. 
     passive: A Boolean indicating that the listener will never call preventDefault(). If it does, the user agent should ignore it and generate a console warning. 

答えて

1

バベルはこのようなことをしません。 Babelは、旧式のブラウザで標準のES6 +構文とライブラリ機能を動作させようとしています。 addEventListenerのDOM APIは、ECMAScript言語仕様で定義されていないため、Babelとは無関係です。

https://github.com/WebReflection/dom4のようなDOMポリフィルをロードしたいとします。

+0

Ah。ありがとうロガン!私はそれがES6だと思っていましたが、意味があります、DOMはES6から分離しています。 – Noitidart

関連する問題