blob: b26ebc9157586268e23e5308479f1f6e4f478128 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<iframe id="xmlframe" onload="frameLoaded()" style="height:0px" src="data:application/xhtml+xml,<?xml version='1.0' encoding='UTF-8'?><body/>"></iframe>
<script>
description('Test DOMJIT documentElement accessor works.');
if (window.testRunner)
testRunner.waitUntilDone();
var target = null;
var result = null;
function runTest()
{
var xmlDocument = document.getElementById('xmlframe').contentDocument;
var targets = [
['HTMLDocument', document, document.firstElementChild],
['XMLDocument', xmlDocument, xmlDocument.firstElementChild],
['Null', document.implementation.createDocument('', null, null), null],
];
for ([name, target, result] of targets) {
var text = `
function test${name}(element, result)
{
for (var i = 0; i < 1e4; ++i) {
if (element.documentElement !== result)
return false;
}
return true;
}
`;
shouldBeTrue(`(${text})(target, result)`);
}
if (window.testRunner)
testRunner.notifyDone();
}
function frameLoaded()
{
runTest();
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>