Files
sousa-gecko/testing/web-platform/tests/svg/path/interfaces/getPathData-empty-or-missing-d.html
T
Virali Purbey 1fc8e80116 Bug 2047780 [wpt PR 60645] - [SVG] Implement getPathData() on SVGPathElement, a=testonly
Automatic update from web-platform-tests
[SVG] Implement `getPathData()` on `SVGPathElement`

Implements the `SVGPathData` interface mixin from the SVG Paths spec
[1] on `SVGPathElement`, exposing:

`sequence<SVGPathSegment> getPathData(optional SVGPathDataSettings);`

plus the `SVGPathSegment {type, values}` and `SVGPathDataSettings
{normalize}` dictionaries.

The method reads the `d` attribute base value (ignoring SMIL/CSS) and,
for <use> shadow instances, forwards to `CorrespondingElement()`.
With `{normalize: true}`, segments are reduced to absolute M, L, C,
Z via `SVGPathNormalizer`.

Gated behind the new experimental runtime flag `SVGPathDataAPI`.
Instrumented via `SVGPathElementGetPathData` and
`SVGPathElementGetPathDataNormalized` use counters.

[1] https://svgwg.org/specs/paths/#__svg__SVGPathData__getPathData

Design: https://docs.google.com/document/d/1uCVUqYGKgsCCu7LEtEdO3Yuea-MT-I2XsU6Eoe3mlQI/edit?usp=sharing

Bug: 40441025
Change-Id: I960bf62b31800b44bd5dd71d1e04acde8bed0553
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7859157
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Virali Purbey <viralipurbey@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1647018}

--

wpt-commits: 13a109f13381905050713b0d4aab3fdf62a1da06
wpt-pr: 60645
2026-06-18 14:39:46 +00:00

22 lines
772 B
HTML

<!doctype html>
<title>SVGPathElement.getPathData() with empty or missing d attribute</title>
<link rel="help" href="https://svgwg.org/specs/paths/#InterfaceSVGPathData">
<link rel="author" title="Virali Purbey" href="mailto:viralipurbey@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/getPathData-helpers.js"></script>
<svg>
<path id="pathMissingD"/>
<path id="pathEmptyD" d=""/>
</svg>
<script>
test(() => {
assert_path_data_equals(pathMissingD.getPathData(), []);
}, "path.getPathData() with missing d attribute returns []");
test(() => {
assert_path_data_equals(pathEmptyD.getPathData(), []);
}, "path.getPathData() with empty d attribute returns []");
</script>