From 33cf8c381ca4ff414ac4e3785236a9454324c2c5 Mon Sep 17 00:00:00 2001 From: Dennis Kaspar Date: Tue, 30 Mar 2021 11:28:42 +0200 Subject: [PATCH] Update dom.ts added trusted modifier to dom.ts --- src/runtime/internal/dom.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 8d99234c9d..0cf3c813b9 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -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);