From 097bc1d1c886bc622e4702eae319f588e18279c0 Mon Sep 17 00:00:00 2001 From: navyansh007 <91735202+navyansh007@users.noreply.github.com> Date: Fri, 20 Jun 2025 23:54:41 +0530 Subject: [PATCH] Remove invalid global data attribute (#4270) * Remove invalid global data attribute Removes the non-existent global 'data' attribute from HTML global attributes that was referencing broken MDN documentation. HTML specification only supports data-* custom attributes and the element, not a global 'data' attribute. Fixes #4241 * fix other attributes using datas --------- Co-authored-by: Jonathan Kelley --- examples/wgpu-texture/src/main.rs | 2 +- packages/document/src/elements/meta.rs | 4 ++++ packages/html/src/attribute_groups.rs | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/wgpu-texture/src/main.rs b/examples/wgpu-texture/src/main.rs index c145709e0..b4d40b3a7 100644 --- a/examples/wgpu-texture/src/main.rs +++ b/examples/wgpu-texture/src/main.rs @@ -99,7 +99,7 @@ fn SpinningCube(color: Memo) -> Element { div { id:"canvas-container", canvas { id: "demo-canvas", - data: paint_source_id + "data": paint_source_id } } ) diff --git a/packages/document/src/elements/meta.rs b/packages/document/src/elements/meta.rs index c0ba793e2..c54c3dd6e 100644 --- a/packages/document/src/elements/meta.rs +++ b/packages/document/src/elements/meta.rs @@ -11,6 +11,7 @@ pub struct MetaProps { pub charset: Option, pub http_equiv: Option, pub content: Option, + pub data: Option, #[props(extends = meta, extends = GlobalAttributes)] pub additional_attributes: Vec, } @@ -35,6 +36,9 @@ impl MetaProps { if let Some(content) = &self.content { attributes.push(("content", content.clone())); } + if let Some(data) = &self.data { + attributes.push(("data", data.clone())); + } attributes } } diff --git a/packages/html/src/attribute_groups.rs b/packages/html/src/attribute_groups.rs index fc456c196..297b2013e 100644 --- a/packages/html/src/attribute_groups.rs +++ b/packages/html/src/attribute_groups.rs @@ -279,8 +279,6 @@ mod_methods! { /// contenteditable; - /// - data; /// dir;