<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
        <script type="text/javascript">

function moveDiv(dv) {
    dv.style.left = '100px';
    dv.style.top = '100px';
}
                
var oHead = document.getElementsByTagName('head')[0];

function createAndAppend() {
    if (window.testRunner) {
            testRunner.waitUntilDone();
    }

        var oElm = document.createElement('div')
        oElm.style.background = '#FCF';
        oElm.style.width = '100px';
        oElm.style.height = '100px';

        document.body.appendChild(oElm);

        var oLink = document.createElement('link');

        oLink.setAttribute('rel', 'stylesheet');
        oLink.setAttribute('type', 'text/css');
        oLink.setAttribute('media', 'screen');
        oLink.setAttribute('href','about:blank;');

        oHead.appendChild(oLink);

        oLink.setAttribute('href','about:blank;');
                        
    setTimeout(moveDiv(oElm), 1000);

    if (window.testRunner) {
            testRunner.notifyDone();
    }
}
        </script>
</head>
<body onload="createAndAppend();">
<p>This is a test to check if the loading of a stylesheet is properly cancelled (count of pending style sheets is decremented) when its link tag is changed through the DOM after the link tag is appended to the document.  When the div with style is moved, it appears on the screen if the style was loaded properly, and doesn't appear when there are out-standing stylesheets according to the DocLoader.  See <a href="https://bugs.webkit.org/show_bug.cgi?id=6999">6999</a></p>
<p><span style="color: red; font-weight: bold;">Fails</span> if there <span style="color: red; font-weight: bold;">is no</span> pink box on the screen.</p>
<p><span style="color: green; font-weight: bold;">Passes</span> if there <span style="color: green; font-weight: bold;">is</span> a pink box on the screen.</p>
</body>
</html>
