Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: third_party/polymer/components/iron-dropdown/iron-dropdown-scroll-manager.html

Issue 3010683002: Update Polymer components. (Closed)
Patch Set: Rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/components/iron-dropdown/iron-dropdown-scroll-manager.html
diff --git a/third_party/polymer/components/iron-dropdown/iron-dropdown-scroll-manager.html b/third_party/polymer/components/iron-dropdown/iron-dropdown-scroll-manager.html
index 451ef3efc652a35f53493baa9d30df35c7b793bc..125bf2b3766502561395b375cb68367318e23a4e 100644
--- a/third_party/polymer/components/iron-dropdown/iron-dropdown-scroll-manager.html
+++ b/third_party/polymer/components/iron-dropdown/iron-dropdown-scroll-manager.html
@@ -31,6 +31,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
var lastScrollableNodes = [];
+ var scrollEvents = [
+ // Modern `wheel` event for mouse wheel scrolling:
+ 'wheel',
+ // Older, non-standard `mousewheel` event for some FF:
+ 'mousewheel',
+ // IE:
+ 'DOMMouseScroll',
+ // Touch enabled devices
+ 'touchstart',
+ 'touchmove'
+ ];
+
/**
* The IronDropdownScrollManager is intended to provide a central source
* of authority and control over which elements in a document are currently
@@ -199,24 +211,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_lockScrollInteractions: function() {
this._boundScrollHandler = this._boundScrollHandler ||
this._scrollInteractionHandler.bind(this);
- // Modern `wheel` event for mouse wheel scrolling:
- document.addEventListener('wheel', this._boundScrollHandler, true);
- // Older, non-standard `mousewheel` event for some FF:
- document.addEventListener('mousewheel', this._boundScrollHandler, true);
- // IE:
- document.addEventListener('DOMMouseScroll', this._boundScrollHandler, true);
- // Save the lastScrollableNodes on touchstart, to be used on touchmove.
- document.addEventListener('touchstart', this._boundScrollHandler, true);
- // Mobile devices can scroll on touch move:
- document.addEventListener('touchmove', this._boundScrollHandler, true);
+ for (var i = 0, l = scrollEvents.length; i < l; i++) {
+ // NOTE: browsers that don't support objects as third arg will
+ // interpret it as boolean, hence useCapture = true in this case.
+ document.addEventListener(scrollEvents[i], this._boundScrollHandler, {
+ capture: true,
+ passive: false
+ });
+ }
},
_unlockScrollInteractions: function() {
- document.removeEventListener('wheel', this._boundScrollHandler, true);
- document.removeEventListener('mousewheel', this._boundScrollHandler, true);
- document.removeEventListener('DOMMouseScroll', this._boundScrollHandler, true);
- document.removeEventListener('touchstart', this._boundScrollHandler, true);
- document.removeEventListener('touchmove', this._boundScrollHandler, true);
+ for (var i = 0, l = scrollEvents.length; i < l; i++) {
+ // NOTE: browsers that don't support objects as third arg will
+ // interpret it as boolean, hence useCapture = true in this case.
+ document.removeEventListener(scrollEvents[i], this._boundScrollHandler, {
+ capture: true,
+ passive: false
+ });
+ }
},
/**
« no previous file with comments | « third_party/polymer/components/iron-dropdown/bower.json ('k') | third_party/polymer/components/iron-fit-behavior/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698