1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
elinks/test/ecmascript/assert/element.outerHTML.html

33 lines
739 B
HTML
Raw Normal View History

2024-05-08 10:14:43 -04:00
<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()
{
2024-05-08 12:57:11 -04:00
var container = document.getElementById("container");
var d = document.getElementById("d");
2024-05-08 10:14:43 -04:00
console.assert(container.firstElementChild.nodeName === 'DIV', 'DIV');
2024-05-08 12:32:59 -04:00
d.outerHTML = '<p>' + d.outerHTML + '</p>';
2024-05-08 10:14:43 -04:00
console.assert(container.firstElementChild.nodeName === 'P', 'P');
2024-05-08 12:32:59 -04:00
console.assert(container.innerHTML === '\n <p></p><div id="d">This is a div.</div><p></p>\n', 'div p div');
2024-05-08 10:14:43 -04:00
}
console.error('element.outerHTML.html');
aa();
bb();
console.exit(0);
</script>
</body>
</html>