<!DOCTYPE html>
<body>
<script src="../../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
description('Test basic usage of document.currentScript')
function logCurrentScript() {
var script = document.currentScript
var s = '<script id="' + script.id + '"';
if (script.src)
s += ' src="..."';
if (script.defer)
s += ' defer';
if (script.async)
s += ' async';
s += '>';
debug(s);
}
</script>
<script id="a">
logCurrentScript();
</script>
<script id="b">
logCurrentScript();
</script>
<script id="c">
logCurrentScript();
document.write('<script id="d">logCurrentScript();<\/script>');
logCurrentScript();
</script>
<script id="defer-1" defer src="resources/log-current-script.js"></script>
<script id="e" src="resources/log-current-script.js"></script>
<script id="f">
logCurrentScript();
document.write('<script id="g" src="resources/log-current-script.js"><\/script>');
logCurrentScript();
</script>
<script id="h">
logCurrentScript();
document.write('<script id="defer-2" defer src="resources/log-current-script.js"><\/script>');
logCurrentScript();
</script>
<script id="i">
logCurrentScript();
var script = document.createElement('script');
script.id = 'j';
script.textContent = 'logCurrentScript();';
script.async = false;
script.defer = false;
document.head.appendChild(script);
logCurrentScript();
</script>
<script id="svg_in_html">
logCurrentScript();
var svg = document.createElementNS("htttp://www.w3.org/2000/svg", "svg");
var script = document.createElementNS("http://www.w3.org/2000/svg", "script");
script.id = "svg script";
script.textContent = 'logCurrentScript();';
svg.appendChild(script);
document.head.appendChild(script);
</script>
<script>
window.onload = function() {
shouldBeNull('document.currentScript');
finishJSTest();
};
</script>
</body>
</html>