Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TemplateStamp event listen param types from Node to EventTarget. #5320

Merged
merged 4 commits into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Node) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a check for Element to ensure the style property.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (HTMLElement actually)

// 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