SVGElement: attributeStyleMap property - Web APIs | MDN
Value
A live StylePropertyMap object.
Examples
The following code snippet shows the relationship between the style attribute and the attributeStyleMap property:
html
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 250 250"
width="250"
height="250">
<circle
cx="100"
cy="100"
r="50"
id="el"
style="border-top: 1px solid blue; color: red;" />
</svg>
<div id="output"></div>
css
#el {
font-size: 16px;
}
#output {
white-space: pre-line;
}
js
const element = document.getElementById("el");
const output = document.getElementById("output");
for (const property of element.attributeStyleMap) {
output.textContent += `${property[0]} = ${property[1][0].toString()}\n`;
}
Specifications
| Specification |
|---|
| CSS Typed OM Level 1 # dom-elementcssinlinestyle-attributestylemap |