Skip to content

Commit

Permalink
Update TemplateStamp event listen param types from Node to EventTarge…
Browse files Browse the repository at this point in the history
…t. (#5320)

Update TemplateStamp event listen param types from Node to EventTarget.

Allows passing e.g. window.
  • Loading branch information
aomarks authored Aug 11, 2018
1 parent 59405b5 commit e8167f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/mixins/gesture-event-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const GestureEventListeners = dedupingMixin(
/**
* Add the event listener to the node if it is a gestures event.
*
* @param {!Node} node Node to add event listener to
* @param {!EventTarget} node Node to add event listener to
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to add
* @return {void}
Expand All @@ -60,7 +60,7 @@ export const GestureEventListeners = dedupingMixin(
/**
* Remove the event listener to the node if it is a gestures event.
*
* @param {!Node} node Node to remove event listener from
* @param {!EventTarget} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to remove
* @return {void}
Expand Down
6 changes: 3 additions & 3 deletions lib/mixins/template-stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export const TemplateStamp = dedupingMixin(
* This method generates a handler function that looks up the method
* name at handling time.
*
* @param {!Node} node Node to add listener on
* @param {!EventTarget} node Node to add listener on
* @param {string} eventName Name of event
* @param {string} methodName Name of method
* @param {*=} context Context the method will be called on (defaults
Expand All @@ -462,7 +462,7 @@ export const TemplateStamp = dedupingMixin(
/**
* Override point for adding custom or simulated event handling.
*
* @param {!Node} node Node to add event listener to
* @param {!EventTarget} node Node to add event listener to
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to add
* @return {void}
Expand All @@ -475,7 +475,7 @@ export const TemplateStamp = dedupingMixin(
/**
* Override point for adding custom or simulated event handling.
*
* @param {!Node} node Node to remove event listener from
* @param {!EventTarget} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to remove
* @return {void}
Expand Down
12 changes: 6 additions & 6 deletions lib/utils/gestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ function _handleTouchAction(ev) {
/**
* Adds an event listener to a node for the given gesture type.
*
* @param {!Node} node Node to add listener on
* @param {!EventTarget} node Node to add listener on
* @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
* @param {!function(!Event):void} handler Event listener function to call
* @return {boolean} Returns true if a gesture event listener was added.
Expand All @@ -509,7 +509,7 @@ export function addListener(node, evType, handler) {
/**
* Removes an event listener from a node for the given gesture type.
*
* @param {!Node} node Node to remove listener from
* @param {!EventTarget} node Node to remove listener from
* @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
* @param {!function(!Event):void} handler Event listener function previously passed to
* `addListener`.
Expand All @@ -527,7 +527,7 @@ export function removeListener(node, evType, handler) {
* automate the event listeners for the native events
*
* @private
* @param {!Node} node Node on which to add the event.
* @param {!EventTarget} node Node on which to add the event.
* @param {string} evType Event type to add.
* @param {function(!Event)} handler Event handler function.
* @return {void}
Expand Down Expand Up @@ -566,7 +566,7 @@ function _add(node, evType, handler) {
* automate event listener removal for native events
*
* @private
* @param {!Node} node Node on which to remove the event.
* @param {!EventTarget} node Node on which to remove the event.
* @param {string} evType Event type to remove.
* @param {function(!Event): void} handler Event handler function.
* @return {void}
Expand Down Expand Up @@ -630,12 +630,12 @@ function _findRecognizerByEvent(evName) {
* This value is checked on first move, thus it should be called prior to
* adding event listeners.
*
* @param {!Node} node Node to set touch action setting on
* @param {!EventTarget} node Node to set touch action setting on
* @param {string} value Touch action value
* @return {void}
*/
export function setTouchAction(node, value) {
if (HAS_NATIVE_TA) {
if (HAS_NATIVE_TA && node instanceof HTMLElement) {
// NOTE: add touchAction async so that events can be added in
// custom element constructors. Otherwise we run afoul of custom
// elements restriction against settings attributes (style) in the
Expand Down

0 comments on commit e8167f7

Please sign in to comment.