PolymerElements / iron-overlay-behavior

Makes an element an overlay with an optional backdrop
41 stars 71 forks source link

Update deprecated function call #299

Closed mgiuffrida closed 5 years ago

mgiuffrida commented 5 years ago

Replace call to deprecated Polymer.Gestures.add function with Polymer.Gestures.addListener.

Fixes a Closure compiler error (JSC_DEPRECATED_PROP_REASON).

mgiuffrida commented 5 years ago

@aomarks can you PTAL? We have had to patch this into Chromium (crbug.com/997852).

aomarks commented 5 years ago

Looks correct (https://polymer-library.polymer-project.org/3.0/docs/devguide/gesture-events). Thanks for the PR.

aomarks commented 5 years ago

Oops, sorry. I just realized that this PR was targeting the 1.x branch. I'm going to need to roll this back. Polymer 1.x only defines Gestures.add: https://github.com/Polymer/polymer/blob/1.x/src/standard/gestures.html#L341, so this change doesn't make sense.

Polymer 2 and 3 do define add as a @deprecated alias for addListener: 2.x: https://github.com/Polymer/polymer/blob/2.x/lib/utils/gestures.html#L1104 3.x: https://github.com/Polymer/polymer/blob/master/lib/utils/gestures.js#L1081

And the 2.x and 3.x versions of this library do indeed call .add (https://github.com/PolymerElements/iron-overlay-behavior/blob/2.x/iron-overlay-manager.html#L48 and https://github.com/PolymerElements/iron-overlay-behavior/blob/master/iron-overlay-manager.js#L49).

Are you sure you're using the right version of Polymer and/or this element library? If you'd still like to fix it in the 2.x and/or latest branches, please send another PR.

mgiuffrida commented 5 years ago

I see. Chromium is pulling down Polymer 2.x so that's the branch I need to target -- I'll open a PR for master first though.