blob: 036d122fc7f919fbe0a6d0d96b61bbac2646cb22 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<div id="parentNode">
<div id="previousSibling"></div><div id="target"><div id="firstChild"></div><div id="lastChild"></div></div><div id="nextSibling"></div>
</div>
<script>
description('Test DOMJIT function getElementById will be LICM-ed.');
function test(doc, id) {
var ret = 0;
for (var i = 0; i < 1e4; ++i) {
ret = doc.getElementById(id).nodeType;
}
return ret;
}
var result;
(function () {
var fragment = document.createDocumentFragment();
var div = document.createElement('div');
div.setAttribute('id', 'target2');
fragment.appendChild(div);
for (var i = 0; i < 100; ++i) {
result = test(document, 'target');
shouldBe(`result`, `1`, true);
result = test(fragment, 'target2');
shouldBe(`result`, `1`, true);
}
}());
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>