From d63bab922eb0ac567b469305ee7b85f5cefeddc8 Mon Sep 17 00:00:00 2001 From: aMediocreDad Date: Fri, 24 Mar 2023 11:34:54 +0100 Subject: [PATCH 1/3] fix: Revert itemscope defined as boolean attribute --- .../compile/render_dom/wrappers/Element/Attribute.ts | 1 - src/shared/boolean_attributes.ts | 1 - .../samples/attribute-boolean-itemscope/_config.js | 11 ++--------- .../samples/attribute-boolean-itemscope/main.svelte | 6 +----- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts index 6cb3a0021811..64178030f612 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts @@ -364,7 +364,6 @@ const attribute_lookup: { [key in BooleanAttributes]: AttributeMetadata } & { [k indeterminate: { applies_to: ['input'] }, inert: {}, ismap: { property_name: 'isMap', applies_to: ['img'] }, - itemscope: {}, loop: { applies_to: ['audio', 'bgsound', 'video'] }, multiple: { applies_to: ['input', 'select'] }, muted: { applies_to: ['audio', 'video'] }, diff --git a/src/shared/boolean_attributes.ts b/src/shared/boolean_attributes.ts index 668dd9797508..10513ec7122b 100644 --- a/src/shared/boolean_attributes.ts +++ b/src/shared/boolean_attributes.ts @@ -13,7 +13,6 @@ const _boolean_attributes = [ 'hidden', 'inert', 'ismap', - 'itemscope', 'loop', 'multiple', 'muted', diff --git a/test/runtime/samples/attribute-boolean-itemscope/_config.js b/test/runtime/samples/attribute-boolean-itemscope/_config.js index b5b21cfc470b..43041884f82f 100644 --- a/test/runtime/samples/attribute-boolean-itemscope/_config.js +++ b/test/runtime/samples/attribute-boolean-itemscope/_config.js @@ -1,11 +1,4 @@ +// There is no relationship between the attribute name and the document node https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata export default { - props: { - itemscope: true - }, - test({ assert, target, component }) { - const div = target.querySelector('div'); - assert.ok(div.itemscope); - component.itemscope = false; - assert.ok(!div.itemscope); - } + html: '
' }; diff --git a/test/runtime/samples/attribute-boolean-itemscope/main.svelte b/test/runtime/samples/attribute-boolean-itemscope/main.svelte index 83265a983c70..50cd039ad386 100644 --- a/test/runtime/samples/attribute-boolean-itemscope/main.svelte +++ b/test/runtime/samples/attribute-boolean-itemscope/main.svelte @@ -1,5 +1 @@ - - -
+
From a8c80d047273fce9abae8778082238190d50577e Mon Sep 17 00:00:00 2001 From: aMediocreDad Date: Fri, 24 Mar 2023 11:35:02 +0100 Subject: [PATCH 2/3] test: Add hidden attribute test --- .../samples/attribute-boolean-hidden/_config.js | 10 ++++++++++ .../samples/attribute-boolean-hidden/main.svelte | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 test/runtime/samples/attribute-boolean-hidden/_config.js create mode 100644 test/runtime/samples/attribute-boolean-hidden/main.svelte diff --git a/test/runtime/samples/attribute-boolean-hidden/_config.js b/test/runtime/samples/attribute-boolean-hidden/_config.js new file mode 100644 index 000000000000..cb38feb93d51 --- /dev/null +++ b/test/runtime/samples/attribute-boolean-hidden/_config.js @@ -0,0 +1,10 @@ +export default { + props: { + hidden: true + }, + html: '