Merge pull request #2185 from Panya/issue-2184

Don't invalidate `this`. Fixes #2184
pull/2191/head
Rich Harris 6 years ago committed by GitHub
commit 06040d3513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -165,9 +165,14 @@ export default function dom(
}
if (node.type === 'AssignmentExpression') {
const names = node.left.type === 'MemberExpression'
? [getObject(node.left).name]
: extractNames(node.left);
let names = [];
if (node.left.type === 'MemberExpression') {
const left_object_name = getObject(node.left).name;
left_object_name && (names = [left_object_name]);
} else {
names = extractNames(node.left);
}
if (node.operator === '=' && nodes_match(node.left, node.right)) {
const dirty = names.filter(name => {

@ -0,0 +1,42 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, addListener, createElement, detachNode, init, insert, noop, safe_not_equal } from "svelte/internal";
function create_fragment(ctx) {
var input, dispose;
return {
c() {
input = createElement("input");
dispose = addListener(input, "input", make_uppercase);
},
m(target, anchor) {
insert(target, input, anchor);
},
p: noop,
i: noop,
o: noop,
d(detach) {
if (detach) {
detachNode(input);
}
dispose();
}
};
}
function make_uppercase() {
this.value = this.value.toUpperCase();
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal);
}
}
export default SvelteComponent;

@ -0,0 +1,6 @@
<script>
function make_uppercase() {
this.value = this.value.toUpperCase();
}
</script>
<input on:input={make_uppercase}>
Loading…
Cancel
Save