Skip to content

Commit fd18392

Browse files
committed
Remove passive event listener check
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent fe03632 commit fd18392

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

js/src/config.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Functions used in configuration forms and on user preferences pages
33
*/
44

5-
/* exported PASSIVE_EVENT_LISTENERS */
6-
75
var configInlineParams;
86
var configScriptLoaded;
97

@@ -841,23 +839,3 @@ function offerPrefsAutoimport () {
841839
});
842840
$cnt.show();
843841
}
844-
845-
/**
846-
* @type {boolean} Support for passive event listener option
847-
*/
848-
var PASSIVE_EVENT_LISTENERS = (function () {
849-
var passive = false;
850-
try {
851-
var options = Object.defineProperty({}, 'passive', {
852-
get: function () {
853-
return (passive = true);
854-
},
855-
});
856-
857-
window.addEventListener('_', null, options);
858-
window.removeEventListener('_', null, options);
859-
} catch (error) {
860-
// passive not supported
861-
}
862-
return passive;
863-
}());

js/src/table/gis_visualization.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @requires vendor/jquery/jquery.mousewheel.js
77
*/
88

9-
/* global drawOpenLayers PASSIVE_EVENT_LISTENERS */ // templates/table/gis_visualization/gis_visualization.twig
9+
/* global drawOpenLayers */ // templates/table/gis_visualization/gis_visualization.twig
1010

1111
// Constants
1212
var zoomFactor = 1.5;
@@ -195,11 +195,7 @@ AJAX.registerTeardown('table/gis_visualization.js', function () {
195195
$(document).off('click', '#up_arrow');
196196
$(document).off('click', '#down_arrow');
197197
$('.vector').off('mousemove').off('mouseout');
198-
$('#placeholder').get(0).removeEventListener(
199-
'wheel',
200-
onGisMouseWheel,
201-
PASSIVE_EVENT_LISTENERS ? { passive: false } : undefined
202-
);
198+
$('#placeholder').get(0).removeEventListener('wheel', onGisMouseWheel, { passive: false });
203199
if (map) {
204200
// Removes ol.Map's resize listener from window
205201
map.setTarget(null);
@@ -230,11 +226,7 @@ AJAX.registerOnload('table/gis_visualization.js', function () {
230226
}
231227
});
232228

233-
$('#placeholder').get(0).addEventListener(
234-
'wheel',
235-
onGisMouseWheel,
236-
PASSIVE_EVENT_LISTENERS ? { passive: false } : undefined
237-
);
229+
$('#placeholder').get(0).addEventListener('wheel', onGisMouseWheel, { passive: false });
238230

239231
var dragX = 0;
240232
var dragY = 0;

0 commit comments

Comments
 (0)