mirror of https://github.com/sveltejs/svelte
prevent false positive detection of events that can be made passive - fixes #1914
parent
cd4f987f4e
commit
18c2ae715f
@ -0,0 +1,50 @@
|
|||||||
|
/* generated by Svelte vX.Y.Z */
|
||||||
|
import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, identity, init, insert, noop, run, safe_not_equal } from "svelte/internal";
|
||||||
|
|
||||||
|
function create_fragment(component, ctx) {
|
||||||
|
var a, current, dispose;
|
||||||
|
|
||||||
|
return {
|
||||||
|
c() {
|
||||||
|
a = createElement("a");
|
||||||
|
a.textContent = "this should not navigate to example.com";
|
||||||
|
a.href = "https://example.com";
|
||||||
|
dispose = addListener(a, "touchstart", touchstart_handler);
|
||||||
|
},
|
||||||
|
|
||||||
|
m(target, anchor) {
|
||||||
|
insert(target, a, anchor);
|
||||||
|
current = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
p: noop,
|
||||||
|
|
||||||
|
i(target, anchor) {
|
||||||
|
if (current) return;
|
||||||
|
this.m(target, anchor);
|
||||||
|
},
|
||||||
|
|
||||||
|
o: run,
|
||||||
|
|
||||||
|
d(detach) {
|
||||||
|
if (detach) {
|
||||||
|
detachNode(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function touchstart_handler(e) {
|
||||||
|
return e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
class SvelteComponent extends SvelteComponent_1 {
|
||||||
|
constructor(options) {
|
||||||
|
super();
|
||||||
|
init(this, options, identity, create_fragment, safe_not_equal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SvelteComponent;
|
@ -0,0 +1,3 @@
|
|||||||
|
<a href="https://example.com" on:touchstart="{e => e.preventDefault()}">
|
||||||
|
this should not navigate to example.com
|
||||||
|
</a>
|
Loading…
Reference in new issue