blob: ca0751cea05f4e610656c51ff4a8a9d8d16e4a3b [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/microdata-common.js"></script>
</head>
<body>
<p>This test ensures that writing to itemValue must throw an INVALID_ACCESS_ERR error if the element has an itemscope attribute.</p>
<div id="console"></div>
<script>
var exceptionCode;
function runTest(tagName)
{
debug("Testing '" + tagName + "' element's behavior.");
exceptionCode = undefined;
testElement = createElement(tagName, {itemscope: 'itemscope', itemprop: 'foo', content: 'test'});
try {
testElement.itemValue = 'test'
} catch (exception) {
exceptionCode = exception.code;
}
if (exceptionCode == DOMException.INVALID_ACCESS_ERR)
debug("TEST SUCCEEDED: Got the expected exception (" + exceptionCode + ") INVALID_ACCESS_ERR.<br>");
else
debug("TEST FAILED: Should've thrown INVALID_ACCESS_ERR but threw " + exceptionCode + ".<br>");
}
runTest('meta');
runTest('audio');
runTest('embed');
runTest('iframe');
runTest('img');
runTest('source');
runTest('track');
runTest('video');
runTest('a');
runTest('area');
runTest('link');
runTest('object');
runTest('div');
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html