Don't sanitize. That's not the role here.
This commit is contained in:
parent
1b0175d237
commit
1300129ecc
@ -1,6 +1,6 @@
|
|||||||
import { isFunction } from 'trimkit';
|
import { isFunction } from 'trimkit';
|
||||||
|
|
||||||
import { sanitizeObject, supportsPassive } from './utils.js';
|
import { supportsPassive } from './utils.js';
|
||||||
|
|
||||||
const OVERRIDING_EVENTS = ['contextmenu', 'dragover', 'drop'];
|
const OVERRIDING_EVENTS = ['contextmenu', 'dragover', 'drop'];
|
||||||
function getEventList(element) {
|
function getEventList(element) {
|
||||||
@ -20,12 +20,7 @@ export function Projector(domRoot) {
|
|||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fakeEvt = sanitizeObject(evt);
|
eventCallbacks.forEach(cb => cb(evt));
|
||||||
if (evt.target) {
|
|
||||||
fakeEvt.target = evt.target._id;
|
|
||||||
}
|
|
||||||
|
|
||||||
eventCallbacks.forEach(cb => cb(fakeEvt));
|
|
||||||
}
|
}
|
||||||
function removeEvent(eventSet, id, eventName) {
|
function removeEvent(eventSet, id, eventName) {
|
||||||
eventSet.remove(element._id);
|
eventSet.remove(element._id);
|
||||||
|
|||||||
@ -1,16 +1,3 @@
|
|||||||
export const NORMAL_OBJECT_PROP_TYPES = ['number', 'string', 'boolean'];
|
|
||||||
|
|
||||||
export function sanitizeObject(obj) {
|
|
||||||
const output = {};
|
|
||||||
for (const key in evt) {
|
|
||||||
const value = evt[key];
|
|
||||||
if (NORMAL_OBJECT_PROP_TYPES.includes(typeof value)) {
|
|
||||||
output[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extrapolated from https://github.com/zzarcon/default-passive-events/blob/master/default-passive-events.js
|
// Extrapolated from https://github.com/zzarcon/default-passive-events/blob/master/default-passive-events.js
|
||||||
export let supportsPassive = false;
|
export let supportsPassive = false;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user