<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests caching of result of NamedNodeMap named property getter");

var bodyAttributes = document.body.attributes;
shouldBe("bodyAttributes.class", "undefined");

var lastIterationHasRightValue = false;
for (var i = 0; i < 1000; i++) {
    if (i == 999)
        document.body.setAttribute('class', 'test');
    if (bodyAttributes.class != undefined) {
        if (i == 999)
            lastIterationHasRightValue = true;
        else
            testFailed("The body element should NOT have a 'class' attribute set");
    }
}

shouldBeTrue("lastIterationHasRightValue");

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
