Added nonpassive as an event modifier

pull/5287/head
filipot 5 years ago
parent 1d9e2a13f2
commit 471754f31e

@ -80,7 +80,8 @@ const valid_modifiers = new Set([
'capture', 'capture',
'once', 'once',
'passive', 'passive',
'self' 'nonpassive',
'self',
]); ]);
const passive_events = new Set([ const passive_events = new Set([

@ -45,12 +45,22 @@ export default class EventHandlerWrapper {
const args = []; const args = [];
const opts = ['passive', 'once', 'capture'].filter(mod => this.node.modifiers.has(mod)); const opts = ['nonpassive', 'passive', 'once', 'capture'].filter(mod => this.node.modifiers.has(mod));
if (opts.length) { if (opts.length) {
args.push((opts.length === 1 && opts[0] === 'capture') let opts_as_string;
? TRUE if(opts[0] === 'nonpassive'){
: x`{ ${opts.map(opt => p`${opt}: true`)} }`); opts.shift();
} else if (block.renderer.options.dev) { if(!opts.includes('passive')){
opts.push('passive');
}
opts_as_string = opts.map(opt => p`${opt}: ${opt === 'passive' ? false : true}`);
}
else{
opts_as_string = opts.map(opt => p`${opt}: true`);
}
args.push((opts.length === 1 && opts[0] === 'capture') ? TRUE : x`{ ${opts_as_string} }`);
}
else if (block.renderer.options.dev) {
args.push(FALSE); args.push(FALSE);
} }

@ -1,5 +1,5 @@
[{ [{
"message": "Valid event modifiers are preventDefault, stopPropagation, capture, once, passive or self", "message": "Valid event modifiers are preventDefault, stopPropagation, capture, once, passive, nonpassive or self",
"code": "invalid-event-modifier", "code": "invalid-event-modifier",
"start": { "start": {
"line": 1, "line": 1,

Loading…
Cancel
Save