Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>textPath `path` attribute is a content attribute only</title>
<link rel="author" title="Karl Dubost" href="mailto:k_dubost@apple.com">
<link rel="help" href="https://github.com/w3c/svgwg/issues/1086">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg width="400" height="200">
<text><textPath id="tp" path="M 20 40 L 380 40">ABCDEF</textPath></text>
</svg>
<script>
const tp = document.getElementById('tp');
test(() => {
assert_true('startOffset' in SVGTextPathElement.prototype, 'startOffset');
assert_true('method' in SVGTextPathElement.prototype, 'method');
assert_true('spacing' in SVGTextPathElement.prototype, 'spacing');
}, 'control: the three declared members are on the prototype');
// Not an oversight in the IDL block: the WG looked at this in svgwg issue 1086 and
// resolved on 2026-04-23 to "Keep path attribute unchanged. No reflection in the IDL
// for this attribute."
test(() => {
assert_false('path' in SVGTextPathElement.prototype);
}, 'path is not reflected on SVGTextPathElement');
test(() => {
assert_equals(tp.getAttribute('path'), 'M 20 40 L 380 40', 'as authored');
tp.setAttribute('path', 'M 0 0 L 10 10');
assert_equals(tp.getAttribute('path'), 'M 0 0 L 10 10', 'after setAttribute');
tp.setAttribute('path', 'M 20 40 L 380 40');
}, 'path round-trips through getAttribute and setAttribute unchanged');
</script>