diff --git a/src/validate/html/validateEventHandler.ts b/src/validate/html/validateEventHandler.ts
index df499a9fd5..b114070993 100644
--- a/src/validate/html/validateEventHandler.ts
+++ b/src/validate/html/validateEventHandler.ts
@@ -6,6 +6,8 @@ import { Node } from '../../interfaces';
const validBuiltins = new Set(['set', 'fire', 'destroy']);
+const validModifiers = new Set(['stop', 'prevent', 'capture', 'once', 'passive']);
+
export default function validateEventHandlerCallee(
validator: Validator,
attribute: Node,
@@ -22,6 +24,17 @@ export default function validateEventHandlerCallee(
});
}
+ const modifiers = attribute.name.split('|').slice(1);
+ if (
+ modifiers.length > 0 &&
+ modifiers.filter(m => !validModifiers.has(m)).length > 0
+ ) {
+ validator.error(attribute, {
+ code: 'invalid-event-modifiers',
+ message: `Valid event modifiers are ${[...validModifiers].join(', ')}.`
+ });
+ }
+
const { name } = flattenReference(callee);
if (validCalleeObjects.has(name) || name === 'options') return;
diff --git a/test/validator/samples/event-modifiers-invalid/errors.json b/test/validator/samples/event-modifiers-invalid/errors.json
new file mode 100644
index 0000000000..99737f50d2
--- /dev/null
+++ b/test/validator/samples/event-modifiers-invalid/errors.json
@@ -0,0 +1,15 @@
+[{
+ "message": "Valid event modifiers are stop, prevent, capture, once, passive.",
+ "code": "invalid-event-modifiers",
+ "start": {
+ "line": 1,
+ "column": 8,
+ "character": 8
+ },
+ "end": {
+ "line": 1,
+ "column": 36,
+ "character": 36
+ },
+ "pos": 8
+}]
\ No newline at end of file
diff --git a/test/validator/samples/event-modifiers-invalid/input.html b/test/validator/samples/event-modifiers-invalid/input.html
new file mode 100644
index 0000000000..27dacdbc2d
--- /dev/null
+++ b/test/validator/samples/event-modifiers-invalid/input.html
@@ -0,0 +1 @@
+
\ No newline at end of file