From 9d6c779f293941f76a9b71f6bd16ec68946d879f Mon Sep 17 00:00:00 2001 From: chowette <45166621+chowette@users.noreply.github.com> Date: Tue, 14 Oct 2025 23:42:12 +0200 Subject: [PATCH] Change "content" attribute of ForeignObject from str to Literal According to the svg.xsd, the content attribute is only allowed to be "structured text" or None The MDN is not documenting this attribute. And the SVG spec did not mention it ( I checked svg 1.1 2nd, svg tiny ) --- svg/elements.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svg/elements.py b/svg/elements.py index a609d21..fdb1004 100644 --- a/svg/elements.py +++ b/svg/elements.py @@ -205,7 +205,7 @@ class Desc(Element, m.GraphicsElementEvents): https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc """ element_name = "desc" - content: str | None = None + content: Literal["structured text"] | None = None class_: list[str] | None = None @@ -216,7 +216,7 @@ class Title(Element, m.GraphicsElementEvents): https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title """ element_name = "title" - content: str | None = None + content: Literal["structured text"] | None = None class_: list[str] | None = None @@ -817,7 +817,7 @@ class ForeignObject(Element, m.Color, m.GraphicsElementEvents, m.Graphics): y: Length | Number | None = None width: Length | Number | None = None height: Length | Number | None = None - content: str | None = None + content: Literal["structured text"] | None = None class_: list[str] | None = None vector_effect: Literal["none", "non-scaling-stroke", "non-scaling-size", "non-rotation", "fixed-position"] | None = None visibility: Literal["visible", "hidden", "inherit"] | None = None