chromium/third_party/blink/web_tests/fast/forms/checkValidity-on-cloned-node.html

<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>

<script>
description('Test checkValidity correctness on input select and textarea element after cloning node .');

// Input
var input = document.createElement('input');
input.required = true;
input.value = "a";
shouldBeTrue('input.checkValidity()');

var clonedInput = input.cloneNode();
shouldBeTrue('clonedInput.checkValidity()');

var clonedInputDeep = input.cloneNode(true);
shouldBeTrue('clonedInputDeep.checkValidity()');

input.value = "";
shouldBeFalse('input.checkValidity()');

var clonedInputNext = input.cloneNode();
shouldBeFalse('clonedInputNext.checkValidity()');

//select  (http://code.google.com/p/chromium/issues/detail?id=461412)
var select = document.createElement('select');
select.innerHTML = "<option>Volvo</option><option>Saab</option><option>Opel</option>";
select.required = true;
shouldBeTrue('select.checkValidity()');

var clonedSelect = select.cloneNode();
shouldBeTrue('clonedSelect.checkValidity()');

var clonedSelectDeep = select.cloneNode(true);
shouldBeTrue('clonedSelectDeep.checkValidity()');

// TextArea (http://code.google.com/p/chromium/issues/detail?id=461414)
var textarea = document.createElement('textarea');
textarea.required = true;
textarea.value = "a";
shouldBeTrue('textarea.checkValidity()');

var clonedTextArea = textarea.cloneNode();
shouldBeTrue('clonedTextArea.checkValidity()');

var clonedTextAreaDeep = textarea.cloneNode(true);
shouldBeTrue('clonedTextAreaDeep.checkValidity()');

</script>
</body>
</html>