59 lines
1.1 KiB
HTML
59 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="target" cocoa="cocoa"><div id="firstChild"></div><div id="lastChild"></div></div>
|
|
</div>
|
|
|
|
<script>
|
|
description('Test DOMJIT functions work.');
|
|
var div;
|
|
(function () {
|
|
div = document.getElementById('target');
|
|
|
|
function a()
|
|
{
|
|
return div.getAttribute('cocoa') === 'cocoa';
|
|
}
|
|
|
|
function b()
|
|
{
|
|
return div.getAttributeNode('cocoa').nodeType === Node.ATTRIBUTE_NODE;
|
|
}
|
|
|
|
function c()
|
|
{
|
|
return div.getElementsByTagName('div').length === 2;
|
|
}
|
|
|
|
function d()
|
|
{
|
|
return div.hasAttribute('cocoa') === true;
|
|
}
|
|
|
|
function main()
|
|
{
|
|
if (!a())
|
|
return false;
|
|
if (!b())
|
|
return false;
|
|
if (!c())
|
|
return false;
|
|
if (!d())
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
for (var i = 0; i < 1e4; ++i) {
|
|
if (!main())
|
|
throw new Error("error");
|
|
}
|
|
testPassed("All tests passed.");
|
|
}());
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|