From 371f0d3e78a47802694e5cb0c6d0c46ac2da4f29 Mon Sep 17 00:00:00 2001 From: ejb Date: Wed, 30 Jul 2025 17:03:35 +0100 Subject: [PATCH 1/2] fix: types for SVG bind: attributes --- packages/svelte/elements.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/svelte/elements.d.ts b/packages/svelte/elements.d.ts index 2e1042dfd6b8..cb0c4086e1dd 100644 --- a/packages/svelte/elements.d.ts +++ b/packages/svelte/elements.d.ts @@ -465,6 +465,13 @@ export interface DOMAttributes { onfullscreenerrorcapture?: EventHandler | undefined | null; xmlns?: string | undefined | null; + + readonly 'bind:contentRect'?: DOMRectReadOnly | undefined | null; + readonly 'bind:contentBoxSize'?: Array | undefined | null; + readonly 'bind:borderBoxSize'?: Array | undefined | null; + readonly 'bind:devicePixelContentBoxSize'?: Array | undefined | null; + readonly 'bind:clientWidth'?: number | undefined | null; + readonly 'bind:clientHeight'?: number | undefined | null; } // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ @@ -839,13 +846,7 @@ export interface HTMLAttributes extends AriaAttributes, D */ 'bind:innerText'?: string | undefined | null; - readonly 'bind:contentRect'?: DOMRectReadOnly | undefined | null; - readonly 'bind:contentBoxSize'?: Array | undefined | null; - readonly 'bind:borderBoxSize'?: Array | undefined | null; - readonly 'bind:devicePixelContentBoxSize'?: Array | undefined | null; readonly 'bind:focused'?: boolean | undefined | null; - readonly 'bind:clientWidth'?: number | undefined | null; - readonly 'bind:clientHeight'?: number | undefined | null; readonly 'bind:offsetWidth'?: number | undefined | null; readonly 'bind:offsetHeight'?: number | undefined | null; From de8f20fd950b8c0250cdad59af94552d51db550e Mon Sep 17 00:00:00 2001 From: 7nik Date: Thu, 31 Jul 2025 13:28:46 +0300 Subject: [PATCH 2/2] add changeset and tweak --- .changeset/cuddly-feet-doubt.md | 5 +++++ packages/svelte/elements.d.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/cuddly-feet-doubt.md diff --git a/.changeset/cuddly-feet-doubt.md b/.changeset/cuddly-feet-doubt.md new file mode 100644 index 000000000000..8d7d955daa4d --- /dev/null +++ b/.changeset/cuddly-feet-doubt.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: add bindable dimension attributes types to SVG and MathML elements diff --git a/packages/svelte/elements.d.ts b/packages/svelte/elements.d.ts index cb0c4086e1dd..b3d44d9ed6b4 100644 --- a/packages/svelte/elements.d.ts +++ b/packages/svelte/elements.d.ts @@ -464,14 +464,15 @@ export interface DOMAttributes { onfullscreenerror?: EventHandler | undefined | null; onfullscreenerrorcapture?: EventHandler | undefined | null; - xmlns?: string | undefined | null; - + // Dimensions readonly 'bind:contentRect'?: DOMRectReadOnly | undefined | null; readonly 'bind:contentBoxSize'?: Array | undefined | null; readonly 'bind:borderBoxSize'?: Array | undefined | null; readonly 'bind:devicePixelContentBoxSize'?: Array | undefined | null; readonly 'bind:clientWidth'?: number | undefined | null; readonly 'bind:clientHeight'?: number | undefined | null; + + xmlns?: string | undefined | null; } // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/