Changes stop and prevent to stopPropagation and preventDefault

pull/1641/head
Admin 6 years ago
parent adfc0e3e45
commit 7c4b9a5a41

@ -6,9 +6,9 @@ export default function getEventModifiers(handlerName: String) {
let modifiers = handlerName.split('|').slice(1);
let eventModifiers = modifiers.reduce((acc, m) => {
if (m === 'stop')
if (m === 'stopPropagation')
acc.bodyModifiers += 'event.stopPropagation();\n';
else if (m === 'prevent')
else if (m === 'preventDefault')
acc.bodyModifiers += 'event.preventDefault();\n';
else if (m === 'capture')
acc.optionModifiers[m] = true;

@ -6,7 +6,7 @@ import { Node } from '../../interfaces';
const validBuiltins = new Set(['set', 'fire', 'destroy']);
const validModifiers = new Set(['stop', 'prevent', 'capture', 'once', 'passive']);
const validModifiers = new Set(['stopPropagation', 'preventDefault', 'capture', 'once', 'passive']);
export default function validateEventHandlerCallee(
validator: Validator,

@ -1,5 +1,5 @@
[{
"message": "Valid event modifiers are stop, prevent, capture, once, passive.",
"message": "Valid event modifiers are stopPropagation, preventDefault, capture, once, passive.",
"code": "invalid-event-modifiers",
"start": {
"line": 1,

Loading…
Cancel
Save