chromium/third_party/blink/web_tests/fast/dom/StyleSheet/detached-style-2.html

<html>
<head>
<link rel="stylesheet" href="resources/detached-style.css" type="text/css" media="screen">
</head>
<body onload="finishTest()">
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=45205">Bug 45205</a>:
Test that &lt;link> elements only have stylesheets when in document.</p>
<pre id=result></pre>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

head = document.getElementsByTagName("head")[0];
link = document.getElementsByTagName("link")[0];
result = document.getElementById("result");

head.removeChild(link);

function finishTest()
{
    result.innerHTML += "Not in document: " + ((link.sheet === null) ? "PASS" : ("FAIL: " + link.sheet)) + "\n";

    head.appendChild(link);

    result.innerHTML += "After adding to document: " + ((link.sheet === null) ? ("FAIL: " + link.sheet) : "PASS") + "\n";

    result.innerHTML += "DONE";
}
</script>
</body>
</html>