Update dom.ts

added trusted modifier to dom.ts
pull/6149/head
Dennis Kaspar 6 years ago committed by GitHub
parent ed01d16a8e
commit 33cf8c381c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -85,6 +85,13 @@ export function self(fn) {
};
}
export function trusted(fn) {
return function(event) {
// @ts-ignore
if (event.isTrusted) fn.call(this, event);
};
}
export function attr(node: Element, attribute: string, value?: string) {
if (value == null) node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);

Loading…
Cancel
Save