diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js index 039c0418ba..9e929a9b69 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js @@ -600,6 +600,24 @@ var xhr = new XMLHttpRequest(); xhr.open('GET', baseUrl + '/tvguide.template.html', true); + var supportsCaptureOption = false; + try { + var opts = Object.defineProperty({}, 'capture', { + get: function () { + supportsCaptureOption = true; + } + }); + window.addEventListener("test", null, opts); + } catch (e) { } + + function addEventListenerWithOptions(target, type, handler, options) { + var optionsOrCapture = options; + if (!supportsCaptureOption) { + optionsOrCapture = options.capture; + } + target.addEventListener(type, handler, optionsOrCapture); + } + xhr.onload = function (e) { var template = this.response; @@ -610,13 +628,17 @@ var timeslotHeaders = context.querySelector('.timeslotHeaders'); programGrid.addEventListener('focus', onProgramGridFocus, true); - programGrid.addEventListener('scroll', function () { + addEventListenerWithOptions(programGrid, 'scroll', function () { onProgramGridScroll(context, this, timeslotHeaders); + }, { + passive: true }); - timeslotHeaders.addEventListener('scroll', function () { + addEventListenerWithOptions(timeslotHeaders, 'scroll', function () { onTimeslotHeadersScroll(context, this, programGrid); + }, { + passive: true }); context.querySelector('.btnSelectDate').addEventListener('click', function () { diff --git a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js index 3acfa9cbdf..0247b0f3cf 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js +++ b/dashboard-ui/bower_components/emby-webcomponents/images/imagehelper.js @@ -43,6 +43,24 @@ define(['visibleinviewport', 'imageFetcher'], function (visibleinviewport, image } } + var supportsCaptureOption = false; + try { + var opts = Object.defineProperty({}, 'capture', { + get: function () { + supportsCaptureOption = true; + } + }); + window.addEventListener("test", null, opts); + } catch (e) { } + + function addEventListenerWithOptions(target, type, handler, options) { + var optionsOrCapture = options; + if (!supportsCaptureOption) { + optionsOrCapture = options.capture; + } + target.addEventListener(type, handler, optionsOrCapture); + } + function unveilElements(images) { if (!images.length) { @@ -103,10 +121,19 @@ define(['visibleinviewport', 'imageFetcher'], function (visibleinviewport, image }, 1); } - document.addEventListener('scroll', unveil, true); + addEventListenerWithOptions(document, 'scroll', unveil, { + capture: true, + passive: true + }); document.addEventListener('focus', unveil, true); - document.addEventListener(wheelEvent, unveil, true); - window.addEventListener('resize', unveil, true); + addEventListenerWithOptions(document, wheelEvent, unveil, { + capture: true, + passive: true + }); + addEventListenerWithOptions(window, 'resize', unveil, { + capture: true, + passive: true + }); unveil(); }