Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /mathml/disabled/dynamic-math-tree-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<script type="application/javascript">
let t = document.getElementById('testnodes');
test(function() {
t.innerHTML = null;
t.appendChild(document.createElementNS(mathmlNS, "math:math"));
assert_equals(t.firstChild.namespaceURI, mathmlNS);
t.firstChild.textContent = "<foo>";
assert_equals(t.innerHTML, "<math:math><foo></math:math>");
}, "Writing '<foo>' element in a dynamically created MathML element.");
test(function() {
t.innerHTML = null;
t.appendChild(document.createElementNS(mathmlNS, "math"));
assert_equals(t.firstChild.namespaceURI, mathmlNS);
t.firstChild.appendChild(document.createElementNS(mathmlNS, "script"));
assert_equals(t.firstChild.firstChild.namespaceURI, mathmlNS);
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
assert_equals(t.innerHTML,
'<math><script>1&2<3>4 \u003C/script></math>');
}, "Writing '<script>' element in a dynamically created MathML element.");
test(function() {
t.innerHTML = null;
t.appendChild(document.createElementNS(mathmlNS, "math"));
assert_equals(t.firstChild.namespaceURI, mathmlNS);
t.firstChild.appendChild(document.createElementNS(mathmlNS, "style"));
assert_equals(t.firstChild.firstChild.namespaceURI, mathmlNS);
t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
assert_equals(t.innerHTML,
'<math><style>1&2<3>4 \u003C/style></math>');
}, "Writing '<style>' element in a dynamically created MathML element.");
</script>
</body>
</html>