From 5cd4f7750e694b2ce15c477c2994e0fa6a214daa Mon Sep 17 00:00:00 2001 From: Kai Erik Niermann <61298289+KaiErikNiermann@users.noreply.github.com> Date: Mon, 24 Jul 2023 07:02:52 +0200 Subject: [PATCH 1/4] docs: add parenthesis back to regex literal example (#9027) * fix: added parenthesis to literal notation example * add prettier-ignore --------- Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com> --- documentation/docs/02-template-syntax/02-basic-markup.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/docs/02-template-syntax/02-basic-markup.md b/documentation/docs/02-template-syntax/02-basic-markup.md index 7656a599be..281790ac71 100644 --- a/documentation/docs/02-template-syntax/02-basic-markup.md +++ b/documentation/docs/02-template-syntax/02-basic-markup.md @@ -113,11 +113,12 @@ Text can also contain JavaScript expressions: > If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses. + ```svelte

Hello {name}!

{a} + {b} = {a + b}.

-
{/^[A-Za-z ]+$/.test(value) ? x : y}
+
{(/^[A-Za-z ]+$/).test(value) ? x : y}
``` ## Comments From a71f3595a35352244cd9b6034fec3cdd72c3de7d Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Mon, 24 Jul 2023 14:26:06 +0200 Subject: [PATCH 2/4] fix: Add data-* to svg attributes (#9036) * Add data-* to svg attributes * Create twelve-suits-drive.md --- .changeset/twelve-suits-drive.md | 5 +++++ packages/svelte/elements.d.ts | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/twelve-suits-drive.md diff --git a/.changeset/twelve-suits-drive.md b/.changeset/twelve-suits-drive.md new file mode 100644 index 0000000000..de7390ae95 --- /dev/null +++ b/.changeset/twelve-suits-drive.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: Add data-* to svg attributes diff --git a/packages/svelte/elements.d.ts b/packages/svelte/elements.d.ts index ec450284c5..9a7e7b3aa8 100644 --- a/packages/svelte/elements.d.ts +++ b/packages/svelte/elements.d.ts @@ -1451,6 +1451,9 @@ export interface SVGAttributes extends AriaAttributes, DO yChannelSelector?: string | undefined | null; z?: number | string | undefined | null; zoomAndPan?: string | undefined | null; + + // allow any data- attribute + [key: `data-${string}`]: any; } export interface HTMLWebViewAttributes extends HTMLAttributes { From 959825c7c4fc92e5f0fb4581bcd8676ed87b0adf Mon Sep 17 00:00:00 2001 From: Conduitry Date: Wed, 26 Jul 2023 17:37:18 -0400 Subject: [PATCH 3/4] chore: fix tests on Node 18.17.0 (#9049) --- packages/svelte/test/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/svelte/test/helpers.js b/packages/svelte/test/helpers.js index 596086f986..b5ee539be8 100644 --- a/packages/svelte/test/helpers.js +++ b/packages/svelte/test/helpers.js @@ -100,7 +100,7 @@ export function show_output(cwd, options = {}) { }); } -const svelte_path = fileURLToPath(new URL('..', import.meta.url)).replace(/\\/g, '/'); +const svelte_path = fileURLToPath(new URL('..', import.meta.url).href).replace(/\\/g, '/'); const AsyncFunction = /** @type {typeof Function} */ (async function () {}.constructor); From 01cbb661d0fc0d52632bd1b0402a997b5b0bcb00 Mon Sep 17 00:00:00 2001 From: Teo Date: Thu, 27 Jul 2023 01:29:34 +0300 Subject: [PATCH 4/4] chore: remove duplicate condition in `if` statement (#9023) --- packages/svelte/src/compiler/compile/nodes/Element.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/svelte/src/compiler/compile/nodes/Element.js b/packages/svelte/src/compiler/compile/nodes/Element.js index 6715eb1e5d..f770cb190d 100644 --- a/packages/svelte/src/compiler/compile/nodes/Element.js +++ b/packages/svelte/src/compiler/compile/nodes/Element.js @@ -530,7 +530,6 @@ export default class Element extends Node { this.name === 'option' || this.is_dynamic_element || this.tag_expr.dynamic_dependencies().length || - this.is_dynamic_element || component.compile_options.dev ) { this.parent.cannot_use_innerhtml(); // need to use add_location