<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="../../resources/js-test-pre.js"></script> | |
</head> | |
<body> | |
<p id="description"></p> | |
<div id="tests"><input type="button"><input type="checkbox"><input type="file"><input type="hidden"> | |
<input type="image"><input type="radio"><input type="range"><input type="reset"><input type="submit"></div> | |
<div id="console"></div> | |
<div> | |
<script type="text/javascript"> | |
description('Tests to ensure selectionStart, selectionEnd, and selectionDirection throw exceptions when the input element is not a text field.'); | |
var tests = document.getElementById('tests'); | |
for (var i = 0; i < tests.children.length; i++) { | |
var test = tests.children[i]; | |
test.focus(); | |
var name = test.type + ' - retrieving selectionStart'; | |
try { | |
var value = test.selectionStart; | |
testFailed(name + ' did not throw an exception'); | |
} catch (e) { | |
testPassed(name + ' threw an exception'); | |
} | |
name = test.type + ' - assigning selectionStart'; | |
try { | |
test.selectionStart = 0; | |
testFailed(name + ' did not throw an exception'); | |
} catch (e) { | |
testPassed(name + ' threw an exception'); | |
} | |
var name = test.type + ' - retrieving selectionEnd'; | |
try { | |
var value = test.selectionEnd; | |
testFailed(name + ' did not throw an exception'); | |
} catch (e) { | |
testPassed(name + ' threw an exception'); | |
} | |
name = test.type + ' - assigning selectionEnd'; | |
try { | |
test.selectionEnd = 0; | |
testFailed(name + ' did not throw an exception'); | |
} catch (e) { | |
testPassed(name + ' threw an exception'); | |
} | |
name = test.type + ' - retrieving selectionDirection'; | |
try { | |
var value = test.selectionDirection; | |
testFailed(name + ' did not throw an exception'); | |
} catch (e) { | |
testPassed(name + ' threw an exception'); | |
} | |
name = test.type + ' - assigning selectionDirection'; | |
try { | |
test.selectionDirection = 'forward'; | |
testFailed(name + ' did not throw an exception'); | |
} catch (e) { | |
testPassed(name + ' threw an exception'); | |
} | |
} | |
tests.style.display = 'none'; | |
</script> | |
<script src="../../resources/js-test-post.js"></script> | |
</body> | |
</html> | |