diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 5a1e2ecfae..7fb4f4aeef 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -600,7 +600,7 @@ export default class Element extends Node { validate_bindings_foreign() { this.bindings - .filter(binding => binding.name !== 'this') + // .filter(binding => binding.name !== 'this') .forEach(binding => { this.component.error(binding, { code: 'invalid-binding', diff --git a/test/validator/index.ts b/test/validator/index.ts index 72364ea89a..030ec59c75 100644 --- a/test/validator/index.ts +++ b/test/validator/index.ts @@ -119,4 +119,17 @@ describe('validate', () => { }); }, /Invalid namespace 'foriegn' \(did you mean 'foreign'\?\)/); }); + + it('throws an error if \'this\' is bound for foreign element', () => { + assert.throws(() => { + svelte.compile(` + +
`, { + name: 'test', + namespace: 'foreign' + }); + }, /'this' is not a valid binding/) + }) });