mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[assert] test case for outerHTML
This commit is contained in:
parent
e11b52b496
commit
b3b6f66c51
31
test/ecmascript/assert/element.outerHTML.html
Normal file
31
test/ecmascript/assert/element.outerHTML.html
Normal file
@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<body>
|
||||
<b id="test">Test</b>
|
||||
|
||||
<div id="container">
|
||||
<div id="d">This is a div.</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function aa()
|
||||
{
|
||||
var a1 = document.getElementById('test').outerHTML;
|
||||
console.assert(a1 === '<b id="test">Test</b>', a1);
|
||||
}
|
||||
|
||||
function bb()
|
||||
{
|
||||
const container = document.getElementById("container");
|
||||
const d = document.getElementById("d");
|
||||
console.assert(container.firstElementChild.nodeName === 'DIV', 'DIV');
|
||||
d.outerHTML = "<p>This paragraph replaced the original div.</p>";
|
||||
console.assert(container.firstElementChild.nodeName === 'P', 'P');
|
||||
}
|
||||
|
||||
console.error('element.outerHTML.html');
|
||||
aa();
|
||||
bb();
|
||||
console.exit(0);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user