<html>
<head>
<script>
if (window.testRunner)
  testRunner.dumpAsText();
</script>
</head>

<body>
    <p>Ensure that Text nodes that are not direct children of Script elements are not included for execution.</p>
    <div id="result">FAIL</div>
    <script>
        // See https://html.spec.whatwg.org/multipage/scripting.html#dom-script-text
        // See <rdar://problem/22587759> script.text shouldn't include text from non-direct children of the script element (148851)

        var script = document.createElement("script");
        script.appendChild(document.createTextNode("document.getElementById('result').innerHTML = 'PASS';"));
        var div = script.appendChild(document.createElement("div"));
        div.appendChild(document.createTextNode("document.getElementById('result').innerHTML = 'FAIL';"))
        document.body.appendChild(script);
    </script>
</body>
</html>
