Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Closed
Changes from all 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
17 changes: 16 additions & 1 deletion src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,21 @@ function specialMouseHandlerWrapper(target, event, handler) {
// These functions chain results into a single
// selector.
//////////////////////////////////////////
function passiveOptionSupported() {
var supportsPassiveOption = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassiveOption = true;
}
});
window.addEventListener('test', null, opts);
// eslint-disable-next-line no-empty
} catch (e) {
}
return supportsPassiveOption;
}

forEach({
removeData: jqLiteRemoveData,

Expand Down Expand Up @@ -881,7 +896,7 @@ forEach({
eventFns = events[type] = [];
eventFns.specialHandlerWrapper = specialHandlerWrapper;
if (type !== '$destroy' && !noEventListener) {
element.addEventListener(type, handle);
element.addEventListener(type, handle, passiveOptionSupported() ? { passive: true } : false);
}
}

Expand Down