LibWeb: Make SVGSVGElement.getElementById() return Element? (nullable)

This is wrong in the spec, and there's already a bug open.
This commit is contained in:
Andreas Kling 2025-01-21 01:06:38 +01:00 committed by Jelle Raaijmakers
parent 8b097b38dd
commit 96e074b38f
Notes: github-actions[bot] 2025-01-21 01:07:31 +00:00
3 changed files with 11 additions and 1 deletions

View file

@ -29,7 +29,8 @@ interface SVGSVGElement : SVGGraphicsElement {
SVGTransform createSVGTransform();
[FIXME] SVGTransform createSVGTransformFromMatrix(optional DOMMatrix2DInit matrix = {});
Element getElementById(DOMString elementId);
// NOTE: The spec says this returns `Element` but that's a bug: https://github.com/w3c/svgwg/issues/923
Element? getElementById(DOMString elementId);
// Deprecated methods that have no effect when called,
// but which are kept for compatibility reasons.

View file

@ -0,0 +1 @@
PASS: true

View file

@ -0,0 +1,8 @@
<script src="../include.js"></script>
<svg id="svgRoot"></svg>
<script>
test(() => {
const x = svgRoot.getElementById("x");
println(`PASS: ${x === null}`);
});
</script>