Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /svg/painting/scripted/marker-element-added.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html class="reftest-wait">
<title><marker> element added after first paint</title>
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
<link rel="match" href="../../struct/reftests/reference/green-100x100.html">
<svg>
<path d="M0,0h100" marker-start="url(#m)"/>
</svg>
<script>
function createSvgElement(name, attrData) {
const element = document.createElementNS(svgNs, name);
attrData.forEach(([name, value]) => element.setAttribute(name, value));
return element;
}
waitForAtLeastOneFrame().then(() => {
const markerElement = createSvgElement('marker', [
['id', 'm'], ['orient', '0'], ['overflow', 'visible']
]);
markerElement.appendChild(createSvgElement('rect', [
['width', '100'], ['height', '100'], ['fill', 'green']
]));
const svg = document.querySelector('svg');
svg.insertBefore(markerElement, svg.firstElementChild);
takeScreenshot();
});
</script>