[svgwg] Support ES6 script modules in SVG (#1033)

shepazu has just created a new issue for https://github.com/w3c/svgwg:

== Support ES6 script modules in SVG ==
Currently, SVG doesn't allow native use of ES6 modules, as in:

```
<script type="module" href="./somescript.js"/>
```

SVG should support ES6 modules.

Attempting to do so throws a console error in at least Chromium (it just fails silently in Safari):

Edge:
> Module scripts in XML documents are currently not supported. See https://go.microsoft.com/fwlink/?linkid=2048115

Chrome
> Module scripts in XML documents are currently not supported. See crbug.com/717643

The issue that points to is about XHTML, not SVG. The conversations there are less than productive, but it shows interest in supporting modules in SVG, and frustration that it's not allowed.

As far as I understand, there are no real issues here, it just needs to be allowed in the SVG spec, which hasn't been updated since modules were introduced.

I suspect this should be easy for browsers, because it's simply no longer special-casing SVG's script handling, but using the same handling as for HTML.

We discussed at least one draft of [SVG 2](https://svgwg.org/svg2-draft/interact.html#ScriptElement) having parity with HTML's script element and attributes. That should be completed as well.

Note that I'm deliberately not opening the can of worms for whether XHTML or XML in general should allow modules. SVG is a very special case of XML.

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1033 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 20 November 2025 15:04:57 UTC