diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts
index f734c2b625c9..aaa230dba27a 100644
--- a/src/compiler/compile/nodes/Element.ts
+++ b/src/compiler/compile/nodes/Element.ts
@@ -131,7 +131,7 @@ export default class Element extends Node {
this.namespace = get_namespace(parent, this, component.namespace);
- if (this.name === 'textarea') {
+ if (this.name === 'textarea' && !this.is_native()) {
if (info.children.length > 0) {
const value_attribute = info.attributes.find(node => node.name === 'value');
if (value_attribute) {
@@ -153,7 +153,7 @@ export default class Element extends Node {
}
}
- if (this.name === 'option') {
+ if (this.name === 'option' && !this.is_native()) {
// Special case — treat these the same way:
//
//
@@ -248,51 +248,53 @@ export default class Element extends Node {
});
}
- if (a11y_distracting_elements.has(this.name)) {
- // no-distracting-elements
- this.component.warn(this, {
- code: 'a11y-distracting-elements',
- message: `A11y: Avoid <${this.name}> elements`
- });
- }
+ if (!this.is_native()) {
+ if (a11y_distracting_elements.has(this.name)) {
+ // no-distracting-elements
+ this.component.warn(this, {
+ code: 'a11y-distracting-elements',
+ message: `A11y: Avoid <${this.name}> elements`
+ });
+ }
- if (this.name === 'figcaption') {
- let { parent } = this;
- let is_figure_parent = false;
+ if (this.name === 'figcaption') {
+ let { parent } = this;
+ let is_figure_parent = false;
- while (parent) {
- if ((parent as Element).name === 'figure') {
- is_figure_parent = true;
- break;
+ while (parent) {
+ if ((parent as Element).name === 'figure') {
+ is_figure_parent = true;
+ break;
+ }
+ if (parent.type === 'Element') {
+ break;
+ }
+ parent = parent.parent;
}
- if (parent.type === 'Element') {
- break;
+
+ if (!is_figure_parent) {
+ this.component.warn(this, {
+ code: 'a11y-structure',
+ message: 'A11y: must be an immediate child of