mirror of
https://github.com/videojs/video.js.git
synced 2024-12-10 11:10:19 +02:00
fix: Don't copy deprecated Event.path (#7782)
This commit is contained in:
parent
a14ace202b
commit
27f22efe6b
@ -117,8 +117,10 @@ export function fixEvent(event) {
|
|||||||
// Safari 6.0.3 warns you if you try to copy deprecated layerX/Y
|
// Safari 6.0.3 warns you if you try to copy deprecated layerX/Y
|
||||||
// Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation
|
// Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation
|
||||||
// and webkitMovementX/Y
|
// and webkitMovementX/Y
|
||||||
|
// Lighthouse complains if Event.path is copied
|
||||||
if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' &&
|
if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' &&
|
||||||
key !== 'webkitMovementX' && key !== 'webkitMovementY') {
|
key !== 'webkitMovementX' && key !== 'webkitMovementY' &&
|
||||||
|
key !== 'path') {
|
||||||
// Chrome 32+ warns if you try to copy deprecated returnValue, but
|
// Chrome 32+ warns if you try to copy deprecated returnValue, but
|
||||||
// we still want to if preventDefault isn't supported (IE8).
|
// we still want to if preventDefault isn't supported (IE8).
|
||||||
if (!(key === 'returnValue' && old.preventDefault)) {
|
if (!(key === 'returnValue' && old.preventDefault)) {
|
||||||
|
@ -383,3 +383,21 @@ QUnit.test('only the first event should call listener via any', function(assert)
|
|||||||
Events.trigger(el, 'event2');
|
Events.trigger(el, 'event2');
|
||||||
assert.equal(triggered, 1, 'listener was not triggered again');
|
assert.equal(triggered, 1, 'listener was not triggered again');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('fixEvent should not copy excluded properties', function(assert) {
|
||||||
|
const event = Events.fixEvent({
|
||||||
|
a: 'a',
|
||||||
|
layerX: 0,
|
||||||
|
layerY: 0,
|
||||||
|
keyLocation: 0,
|
||||||
|
webkitMovementX: 0,
|
||||||
|
webkitMovementY: 0,
|
||||||
|
path: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.true(event.fixed_, 'event is a fixed event');
|
||||||
|
assert.strictEqual(event.a, 'a', 'other props copied');
|
||||||
|
['layerX', 'layerY', 'keyLocation', 'webkitMovementX', 'webkitMovementY', 'path'].forEach(prop => {
|
||||||
|
assert.equal(event[prop], undefined, `${prop} is undefined`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user