From c9635a9afdd006b2f71a4d4535cd36010e25b8ce Mon Sep 17 00:00:00 2001 From: halfnelson Date: Sat, 7 Nov 2020 15:31:28 +1000 Subject: [PATCH 1/7] Introduce the foreign namespace and skip certain handling and warnings Allows the use of svelte for DOM implementations that aren't html5 --- src/compiler/compile/nodes/Element.ts | 281 ++++++++++-------- .../render_dom/wrappers/Element/Attribute.ts | 28 +- src/compiler/utils/namespaces.ts | 6 +- .../_config.js | 18 ++ .../main.svelte | 4 + .../a11y-in-foreign-namespace/input.svelte | 7 + .../a11y-in-foreign-namespace/warnings.json | 1 + .../errors.json | 15 + .../input.svelte | 6 + 9 files changed, 231 insertions(+), 135 deletions(-) create mode 100644 test/runtime/samples/attribute-casing-foreign-namespace/_config.js create mode 100644 test/runtime/samples/attribute-casing-foreign-namespace/main.svelte create mode 100644 test/validator/samples/a11y-in-foreign-namespace/input.svelte create mode 100644 test/validator/samples/a11y-in-foreign-namespace/warnings.json create mode 100644 test/validator/samples/binding-invalid-foreign-namespace/errors.json create mode 100644 test/validator/samples/binding-invalid-foreign-namespace/input.svelte diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index b12e616f4dfb..8c5b4cb9f5c4 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -136,44 +136,45 @@ export default class Element extends Node { this.namespace = get_namespace(parent as Element, this, component.namespace); - if (this.name === 'textarea') { - if (info.children.length > 0) { - const value_attribute = info.attributes.find(node => node.name === 'value'); - if (value_attribute) { - component.error(value_attribute, { - code: 'textarea-duplicate-value', - message: 'A