Support async attribute for SVG <script> element
- Category
- Miscellaneous
- Type
- Chromium catches up
- Status
- On hold (Chrome On hold)
- Intent stage
- None
WPT details: wpt.fyi link: https://wpt.fyi/results/svg/interact/scripted/async-01.svg
Summary
The SVGScriptElement interface in SVG 2.0 introduces the async attribute, similar to the HTMLScriptElement. This attribute allows scripts to be executed asynchronously, improving the performance and responsiveness of web applications that utilize SVG.
Motivation
SVG 2.0 specifies the async attribute for SVGScriptElement, aligning it with the HTMLScriptElement. This alignment is crucial for several reasons: Performance Improvement: Asynchronous script execution enhances web page performance by allowing scripts to load and execute without blocking rendering. This is beneficial for complex SVG graphics relying on external scripts. Consistency Across Web Technologies: Supporting the async attribute in SVGScriptElement ensures consistency between HTML and SVG, simplifying development and reducing errors. Enhanced User Experience: Asynchronous script execution makes web pages more responsive and interactive, improving user experience by reducing delays and interruptions. Interoperability: Firefox already support the async attribute for SVGScriptElement. Adding this feature to Chromium enhances interoperability across browsers, providing a consistent experience for web authors and users. Overall, lacking support for the async attribute in Chromium's SVG 2.0 can cause performance issues, inconsistent user experiences, and increased development complexity. Adding this feature will resolve these problems and align Chromium with other major browsers, creating a more unified web environment.
Standards & signals
- Specification: https://svgwg.org/svg2-draft/interact.html#ScriptElement:~:text=%E2%80%98script%E2%80%99%20element-,SVG%202%20Requirement%3A,Consider%20allowing%20async/defer%20on%20%E2%80%98script%E2%80%99.,-Resolution%3A
- Firefox: Shipped/Shipping
- Safari: No signal
- Web developers: Positive — Three users have noted they are impacted by the CrBug.
- Tracking bug: https://issues.chromium.org/issues/40067618
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=svg%2Finteract%2Fscripted%2Fasync-01
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Support%20async%20attribute%20for%20SVG%20%3Cscript%3E%20element
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Support%20async%20attribute%20for%20SVG%20%3Cscript%3E%20element
- Baseline status: https://webstatus.dev/?q=Support%20async%20attribute%20for%20SVG%20%3Cscript%3E%20element
Docs: https://docs.google.com/document/d/146iVXAKrBpzGYBc88EqxVLRDZyBT13ERVTs5POXcTYA/edit?usp=sharing