- From: Luke Warlow via GitHub <noreply@w3.org>
- Date: Tue, 19 Aug 2025 13:44:24 +0000
- To: public-svg-issues@w3.org
Sure, ultimately the benefit of this is to cut down on spec prose and align with what engines already do in some cases. For example for SVGStyleElement where the published spec currently says An [SVGStyleElement](https://svgwg.org/svg2-draft/styling.html#InterfaceSVGStyleElement) object represents a ‘[style](https://svgwg.org/svg2-draft/styling.html#StyleElement)’ element in the DOM. ```webidl [Exposed=Window] interface SVGStyleElement : [SVGElement](https://svgwg.org/svg2-draft/types.html#InterfaceSVGElement) { attribute DOMString [type](https://svgwg.org/svg2-draft/styling.html#__svg__SVGStyleElement__type); attribute DOMString [media](https://svgwg.org/svg2-draft/styling.html#__svg__SVGStyleElement__media); attribute DOMString [title](https://svgwg.org/svg2-draft/styling.html#__svg__SVGStyleElement__title); }; [SVGStyleElement](https://svgwg.org/svg2-draft/styling.html#InterfaceSVGStyleElement) includes [LinkStyle](https://www.w3.org/TR/cssom-1/#the-linkstyle-interface); ``` The type, media and title IDL attributes [reflect](https://svgwg.org/svg2-draft/types.html#TermReflect) the ‘[type](https://svgwg.org/svg2-draft/styling.html#StyleElementTypeAttribute)’, ‘[media](https://svgwg.org/svg2-draft/styling.html#StyleElementMediaAttribute)’ and ‘[title](https://svgwg.org/svg2-draft/styling.html#StyleElementTitleAttribute)’ content attributes, respectively. We could drop the last block and simply use the below IDL: ```webidl [Exposed=Window] interface SVGStyleElement : [SVGElement](https://svgwg.org/svg2-draft/types.html#InterfaceSVGElement) { [Reflect] attribute DOMString [type](https://svgwg.org/svg2-draft/styling.html#__svg__SVGStyleElement__type); [Reflect] attribute DOMString [media](https://svgwg.org/svg2-draft/styling.html#__svg__SVGStyleElement__media); [Reflect] attribute DOMString [title](https://svgwg.org/svg2-draft/styling.html#__svg__SVGStyleElement__title); }; [SVGStyleElement](https://svgwg.org/svg2-draft/styling.html#InterfaceSVGStyleElement) includes [LinkStyle](https://www.w3.org/TR/cssom-1/#the-linkstyle-interface); ``` As you can see WebKit already has this for title https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGStyleElement.idl#33 In practice the spec is actually wrong currently, because type and media have complex getters where they fallback to a specific value in the case the attribute is missing, but they could still use [ReflectSetter] and then define a custom getter steps. This is currently only usable for reflection that follows the HTML rules. For the reflection that follows SVG special semantics that would be left alone (though should perhaps be addressed in future). -- GitHub Notification of comment by lukewarlow Please view or discuss this issue at https://github.com/w3c/svgwg/issues/991#issuecomment-3200831208 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 19 August 2025 13:44:25 UTC