bug1448747-fastclick-shim.js (997B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1448747 - Neutralize FastClick 9 * 10 * The patch is applied on sites using FastClick library 11 * to make sure `FastClick.notNeeded` returns `true`. 12 * This allows to disable FastClick and fix various breakage caused 13 * by the library (mainly non-functioning drop-down lists). 14 */ 15 16 /* globals exportFunction */ 17 18 (function () { 19 const proto = (window.CSSStyleProperties ?? window.CSS2Properties).prototype 20 .wrappedJSObject; 21 const descriptor = Object.getOwnPropertyDescriptor(proto, "touchAction"); 22 const { get } = descriptor; 23 24 descriptor.get = exportFunction(function () { 25 if (new Error().stack?.includes("notNeeded")) { 26 return "none"; 27 } 28 return get.call(this); 29 }, window); 30 31 Object.defineProperty(proto, "touchAction", descriptor); 32 })();