Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/scripting-1/the-script-element/script-text-xhtml.xhtml - WPT Dashboard Interop Dashboard
<?xml version="1.0" encoding="utf-8"?>
<head>
<title>HTMLScriptElement.text</title>
<script src="/resources/testharness.js"/>
<script src="/resources/testharnessreport.js"/>
</head>
<body>
<div id="log"></div>
<script>
<x>7;</x>
<![CDATA[
var x = "y";
]]>
</script>
<script>
var script;
setup(function() {
script = document.body.getElementsByTagName("script")[0];
})
test(function() {
assert_equals(script.text, '\n\n\n var x = "y";\n\n')
assert_equals(script.textContent, '\n7;\n\n var x = "y";\n\n')
}, "Getter with CDATA section")
</script>
</body>
</html>