<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<style>
:link { fill: red }
:visited { fill: green }
</style>
<a xlink:href="http://notvisited" name="x">
<text x="20" y="40">This text should be green</text>
</a>
<text x="20" y="60" id="result1">Not run (requires window.internals).</text>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.addEventListener('load', () => {
window.location.hash = "#x";
requestAnimationFrame(function(){
// Change href from non-visited to visited link.
getComputedStyle(document.documentElement);
document.querySelector("a").setAttribute("xlink:href", "#x");
if (window.internals) {
var resultText = document.getElementById("result1").firstChild;
var elementCount = internals.updateStyleAndReturnAffectedElementCount();
// The elementCount should have been 2, but visited links are
// not recognized in content_shell, thus the text color doesn't
// change and an inheritance propagation to text element is not
// necessary. Running this test in Chrome will cause a 2-element
// recalc and green text as expected.
if (elementCount == 1)
resultText.data = "PASS";
else
resultText.data = "FAIL: " + elementCount;
}
if (window.testRunner)
testRunner.notifyDone();
});
});
</script>
</svg>