<script src="../../../resources/js-test-pre.js"></script>
<fieldset id="fs1" name="a"></fieldset>
<script>
description("This test checks fieldset.name attribute.");
debug("Read from HTML");
shouldBe('fs1.name', '"a"');
shouldBe('fs1.getAttribute("name")', '"a"');

debug('fs1.name="b"');
fs1.name = "b";
shouldBe('fs1.name', '"b"');
shouldBe('fs1.getAttribute("name")', '"b"');

debug('fs1.name=1234');
fs1.name = 1234;
shouldBe('fs1.name', '"1234"');
shouldBe('fs1.getAttribute("name")', '"1234"');

// FIXME: The specification doesn't have clear description for setting null to name.
// We may need to update below once the specification fixed.
debug('fs1.name=null');
fs1.name = null;
shouldBeEqualToString('fs1.name', 'null');
shouldBeEqualToString('fs1.getAttribute("name")', 'null');
shouldBeTrue('fs1.hasAttribute("name")');

debug('fs1.name=undefined');
fs1.name = undefined;
shouldBeEqualToString('fs1.name', 'undefined');
shouldBeEqualToString('fs1.getAttribute("name")', 'undefined');
shouldBeTrue('fs1.hasAttribute("name")');
</script>
<script src="../../../resources/js-test-post.js"></script>

