Re: [svgwg] Define how `requiredExtensions` values should be interpretted (#138)

**Proposal**: Adds to the specification, the values for MathML and HTML and be done with it. 

There is no SVG integration spec being really maintained. 
https://w3c.github.io/svgwg/specs/integration/

In the current SVG2 draft
https://w3c.github.io/svgwg/svg2-draft/struct.html#ConditionalProcessingRequiredExtensionsAttribute

> Each extension is identified by an [URL reference](https://w3c.github.io/svgwg/svg2-draft/linking.html#URLReference).

Then it says:

> The value is a list of [URL reference](https://w3c.github.io/svgwg/svg2-draft/linking.html#URLReference)s which identify the required extensions, with the individual values separated by white space. Determines whether all of the named extensions are supported by the user agent. If all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus will not be rendered.

## Implementations Side

### WebKit

Source/WebCore/svg/SVGTests.cpp:60-69

```cpp
bool SVGTests::hasExtension(const String& extension)
{
    // We recognize XHTML and MathML, as implemented in Gecko and suggested in the SVG Tiny
    // recommendation (http://www.w3.org/TR/SVG11/struct.html#RequiredExtensionsAttribute).
#if ENABLE(MATHML)
    if (extension == MathMLNames::mathmlNamespaceURI)
        return true;
#endif
    return extension == HTMLNames::xhtmlNamespaceURI;
}
```

Used by `SVGTests::isValid()` at SVGTests.cpp:71-88, which iterates `requiredExtensions().items()` and returns `false` if any entry isn't recognized. The comment even names Gecko as the source of the convention! This comment needs to be fixed.

### Gecko

dom/svg/SVGTests.cpp:36-48

```cpp
bool SVGTests::HasExtension(const nsAString& aExtension) const {
#define SVG_SUPPORTED_EXTENSION(str) \
  if (aExtension.EqualsLiteral(str)) return true;
  SVG_SUPPORTED_EXTENSION("http://www.w3.org/1999/xhtml")
  nsNameSpaceManager* nameSpaceManager = nsNameSpaceManager::GetInstance();
  if (AsSVGElement()->IsInChromeDocument() ||
      !nameSpaceManager->mMathMLDisabled) {
    SVG_SUPPORTED_EXTENSION("http://www.w3.org/1998/Math/MathML")
  }
#undef SVG_SUPPORTED_EXTENSION

  return false;
}
```

Note Gecko gates MathML behind `mMathMLDisabled` (the MathML disabled pref), but content-document MathML is on by default. The driver `PassesRequiredExtensionsTests()` at `SVGTests.cpp:141-163` iterates the list and bails on the first miss; an explicitly empty list is also rejected.

## Chromium / Blink

third_party/blink/renderer/core/svg/svg_tests.cc:127-139 (inside SVGTests::IsValid())

```cpp
if (required_extensions_ && required_extensions_->IsSpecified()) {
  const Vector<String>& extensions = required_extensions_->Value()->Values();
  // 'If a null string or empty string value is given to attribute
  // 'requiredExtensions', the attribute evaluates to "false".'
  if (extensions.empty())
    return false;
  for (const auto& extension : extensions) {
    if (extension != html_names::xhtmlNamespaceURI &&
        extension != mathml_names::kNamespaceURI) {
      return false;
    }
  }
}
```

The check is inlined (no HasExtension helper) but the set is identical.

## Questions

@Tavmjong Is it used in InkScape? Do you know about software using other values?

-- 
GitHub Notification of comment by karlcow
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/138#issuecomment-4747303189 using your GitHub account


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

Received on Friday, 19 June 2026 00:46:49 UTC