SVGTextPathElement: свойство href
Базовая линия Широко доступно
Эта функция хорошо отработана и работает на многих устройствах и версиях браузеров. Она доступна в браузерах с января 2020 года.
Свойство href только для чтения интерфейса SVGTextPathElement отражает атрибут href (или устаревший атрибут xlink:href) заданного элемента <textPath>.
Значение
Объект SVGAnimatedString.
Примеры
Доступ к свойству href
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200">
<defs>
<path id="myPath" d="M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80" />
</defs>
<text font-size="20" fill="blue">
<textPath id="myTextPath" href="#myPath">
This text follows a path!
</textPath>
</text>
</svg>
const textPath = document.getElementById("myTextPath");
// Access the href property
console.log(textPath.href.baseVal); // Output: "#myPath"
Спецификации
Совместимость браузеров
| Рабочие столы | Мобильные устройства | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox для Android | Opera Android | Safari на iOS | Samsung Internet | WebView Android | |
href |
1 | 12 | 2 | ≤12.1 | 3.1 | 18 | 4 | ≤12.1 | 2 | 1.0 | 3 |
См. также
- Атрибут SVG
href
© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGTextPathElement/href