<?xml-stylesheet href="resources/detached-style.css" media="screen"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=45205">Bug 45205</a>:
Test that <xml-stylesheet> processing instructions only have stylesheets when in document.</p>
<div id="console"></div>
<script>
window.onload = function () {
sheet = document.styleSheets[0];
pi = document.firstChild;
shouldBe('sheet.ownerNode', 'pi')
shouldBe('pi.sheet === sheet', 'true')
debug("Removing &lt;pi>...");
document.removeChild(pi);
shouldBe('pi.sheet', 'null')
shouldBe('sheet.ownerNode', 'null')
shouldBe('sheet.cssRules[0].cssText[0]', '"*"')
debug("Re-adding &lt;pi>...");
document.insertBefore(pi, document.documentElement);
shouldBe('sheet.ownerNode', 'null')
shouldBe('pi.sheet === sheet', 'false')
shouldBe('pi.sheet.ownerNode', 'pi')
}
</script>
</body>
</html>