0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

Changes stop and prevent to stopPropagation and preventDefault

This commit is contained in:
Admin 2018-08-11 21:16:42 -05:00
parent adfc0e3e45
commit 7c4b9a5a41
3 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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,