Stop using script-tests in LayoutTests/fast/forms
https://bugs.webkit.org/show_bug.cgi?id=78667
Reviewed by Kentaro Hara.
* fast/forms/ValidityState-patternMismatch-unsupported.html:
* fast/forms/ValidityState-rangeOverflow.html:
* fast/forms/ValidityState-rangeUnderflow.html:
* fast/forms/ValidityState-stepMismatch.html:
* fast/forms/ValidityState-tooLong-input.html:
* fast/forms/ValidityState-tooLong-textarea.html:
* fast/forms/ValidityState-typeMismatch-date-expected.txt: Removed.
* fast/forms/ValidityState-typeMismatch-url.html:
* fast/forms/ValidityState-valueMissing-radio.html:
* fast/forms/checkValidity-cancel.html:
* fast/forms/checkValidity-handler-updates-dom.html:
* fast/forms/form-attribute-elements-order.html:
* fast/forms/form-attribute-elements-order2.html:
* fast/forms/form-attribute-elements.html:
* fast/forms/form-attribute.html:
* fast/forms/form-collection-elements-order.html:
* fast/forms/form-collection-elements.html:
* fast/forms/formnovalidate-attribute.html:
* fast/forms/incremental-dom-property.html:
* fast/forms/input-maxlength-ime-completed.html:
* fast/forms/input-maxlength-ime-preedit.html:
* fast/forms/input-maxlength-unsupported.html:
* fast/forms/input-minmax.html:
* fast/forms/input-pattern.html:
* fast/forms/input-step.html:
* fast/forms/input-stepup-stepdown.html:
* fast/forms/input-type-change3.html:
* fast/forms/input-valueasnumber-unsupported.html:
* fast/forms/labels-add-htmlFor-label.html:
* fast/forms/labels-add-parent-label.html:
* fast/forms/labels-change-htmlFor-attribute.html:
* fast/forms/labels-item-index.html:
* fast/forms/labels-remove-htmlFor-attribute.html:
* fast/forms/labels-remove-htmlFor-label.html:
* fast/forms/labels-remove-parent-label.html:
* fast/forms/labels-set-htmlFor-attribute.html:
* fast/forms/listbox-deselect-scroll.html:
* fast/forms/listbox-selection-2.html:
* fast/forms/listbox-selection.html:
* fast/forms/menulist-disabled-selected-option.html:
* fast/forms/menulist-submit-without-selection.html:
* fast/forms/novalidate-attribute.html:
* fast/forms/output-reset-assertion-failed.html:
* fast/forms/placeholder-dom-property.html:
* fast/forms/script-tests/TEMPLATE.html: Removed.
* fast/forms/script-tests/ValidityState-patternMismatch-unsupported.js: Removed.
* fast/forms/script-tests/ValidityState-rangeOverflow.js: Removed.
* fast/forms/script-tests/ValidityState-rangeUnderflow.js: Removed.
* fast/forms/script-tests/ValidityState-stepMismatch.js: Removed.
* fast/forms/script-tests/ValidityState-tooLong-input.js: Removed.
* fast/forms/script-tests/ValidityState-tooLong-textarea.js: Removed.
* fast/forms/script-tests/ValidityState-typeMismatch-date.js: Removed.
* fast/forms/script-tests/ValidityState-typeMismatch-url.js: Removed.
* fast/forms/script-tests/ValidityState-valueMissing-radio.js: Removed.
* fast/forms/script-tests/checkValidity-cancel.js: Removed.
* fast/forms/script-tests/checkValidity-handler-updates-dom.js: Removed.
* fast/forms/script-tests/form-attribute-elements-order.js: Removed.
* fast/forms/script-tests/form-attribute-elements-order2.js: Removed.
* fast/forms/script-tests/form-attribute-elements.js: Removed.
* fast/forms/script-tests/form-attribute.js: Removed.
* fast/forms/script-tests/form-collection-elements-order.js: Removed.
* fast/forms/script-tests/form-collection-elements.js: Removed.
* fast/forms/script-tests/formnovalidate-attribute.js: Removed.
* fast/forms/script-tests/incremental-dom-property.js: Removed.
* fast/forms/script-tests/input-maxlength-ime-completed.js: Removed.
* fast/forms/script-tests/input-maxlength-ime-preedit.js: Removed.
* fast/forms/script-tests/input-maxlength-unsupported.js: Removed.
* fast/forms/script-tests/input-minmax.js: Removed.
* fast/forms/script-tests/input-pattern.js: Removed.
* fast/forms/script-tests/input-step.js: Removed.
* fast/forms/script-tests/input-stepup-stepdown.js: Removed.
* fast/forms/script-tests/input-type-change3.js: Removed.
* fast/forms/script-tests/input-valueasnumber-unsupported.js: Removed.
* fast/forms/script-tests/labels-add-htmlFor-label.js: Removed.
* fast/forms/script-tests/labels-add-parent-label.js: Removed.
* fast/forms/script-tests/labels-change-htmlFor-attribute.js: Removed.
* fast/forms/script-tests/labels-item-index.js: Removed.
* fast/forms/script-tests/labels-remove-htmlFor-attribute.js: Removed.
* fast/forms/script-tests/labels-remove-htmlFor-label.js: Removed.
* fast/forms/script-tests/labels-remove-parent-label.js: Removed.
* fast/forms/script-tests/labels-set-htmlFor-attribute.js: Removed.
* fast/forms/script-tests/listbox-deselect-scroll.js: Removed.
* fast/forms/script-tests/listbox-selection-2.js: Removed.
* fast/forms/script-tests/listbox-selection.js: Removed.
* fast/forms/script-tests/menulist-disabled-selected-option.js: Removed.
* fast/forms/script-tests/menulist-submit-without-selection.js: Removed.
* fast/forms/script-tests/novalidate-attribute.js: Removed.
* fast/forms/script-tests/output-reset-assertion-failed.js: Removed.
* fast/forms/script-tests/placeholder-dom-property.js: Removed.
* fast/forms/script-tests/search-cancel-button-events.js: Removed.
* fast/forms/script-tests/select-set-length-optgroup.js: Removed.
* fast/forms/script-tests/select-set-length-with-mutation-remove.js: Removed.
* fast/forms/script-tests/select-set-length-with-mutation-reorder.js: Removed.
* fast/forms/script-tests/select-set-length-with-mutation-reparent.js: Removed.
* fast/forms/script-tests/select-set-length-with-mutation.js: Removed.
* fast/forms/script-tests/select-set-length.js: Removed.
* fast/forms/script-tests/setCustomValidity-existence.js: Removed.
* fast/forms/script-tests/shadow-tree-exposure.js: Removed.
* fast/forms/script-tests/submit-form-attributes.js: Removed.
* fast/forms/script-tests/text-control-intrinsic-widths.js: Removed.
* fast/forms/script-tests/textarea-maxlength.js: Removed.
* fast/forms/script-tests/textarea-metrics.js: Removed.
* fast/forms/script-tests/textarea-placeholder-dom-property.js: Removed.
* fast/forms/script-tests/textarea-rows-cols.js: Removed.
* fast/forms/script-tests/textarea-textlength.js: Removed.
* fast/forms/script-tests/validationMessage.js: Removed.
* fast/forms/script-tests/willvalidate.js: Removed.
* fast/forms/search-cancel-button-events.html:
* fast/forms/select-set-length-optgroup.html:
* fast/forms/select-set-length-with-mutation-remove.html:
* fast/forms/select-set-length-with-mutation-reorder.html:
* fast/forms/select-set-length-with-mutation-reparent.html:
* fast/forms/select-set-length-with-mutation.html:
* fast/forms/select-set-length.html:
* fast/forms/setCustomValidity-existence.html:
* fast/forms/shadow-tree-exposure.html:
* fast/forms/submit-form-attributes.html:
* fast/forms/text-control-intrinsic-widths.html:
* fast/forms/textarea-maxlength.html:
* fast/forms/textarea-metrics.html:
* fast/forms/textarea-placeholder-dom-property.html:
* fast/forms/textarea-rows-cols.html:
* fast/forms/textarea-textlength.html:
* fast/forms/validationMessage.html:
* fast/forms/willvalidate.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f72293a..553c4d8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,136 @@
+2012-02-14 Kent Tamura <tkent@chromium.org>
+
+ Stop using script-tests in LayoutTests/fast/forms
+ https://bugs.webkit.org/show_bug.cgi?id=78667
+
+ Reviewed by Kentaro Hara.
+
+ * fast/forms/ValidityState-patternMismatch-unsupported.html:
+ * fast/forms/ValidityState-rangeOverflow.html:
+ * fast/forms/ValidityState-rangeUnderflow.html:
+ * fast/forms/ValidityState-stepMismatch.html:
+ * fast/forms/ValidityState-tooLong-input.html:
+ * fast/forms/ValidityState-tooLong-textarea.html:
+ * fast/forms/ValidityState-typeMismatch-date-expected.txt: Removed.
+ * fast/forms/ValidityState-typeMismatch-url.html:
+ * fast/forms/ValidityState-valueMissing-radio.html:
+ * fast/forms/checkValidity-cancel.html:
+ * fast/forms/checkValidity-handler-updates-dom.html:
+ * fast/forms/form-attribute-elements-order.html:
+ * fast/forms/form-attribute-elements-order2.html:
+ * fast/forms/form-attribute-elements.html:
+ * fast/forms/form-attribute.html:
+ * fast/forms/form-collection-elements-order.html:
+ * fast/forms/form-collection-elements.html:
+ * fast/forms/formnovalidate-attribute.html:
+ * fast/forms/incremental-dom-property.html:
+ * fast/forms/input-maxlength-ime-completed.html:
+ * fast/forms/input-maxlength-ime-preedit.html:
+ * fast/forms/input-maxlength-unsupported.html:
+ * fast/forms/input-minmax.html:
+ * fast/forms/input-pattern.html:
+ * fast/forms/input-step.html:
+ * fast/forms/input-stepup-stepdown.html:
+ * fast/forms/input-type-change3.html:
+ * fast/forms/input-valueasnumber-unsupported.html:
+ * fast/forms/labels-add-htmlFor-label.html:
+ * fast/forms/labels-add-parent-label.html:
+ * fast/forms/labels-change-htmlFor-attribute.html:
+ * fast/forms/labels-item-index.html:
+ * fast/forms/labels-remove-htmlFor-attribute.html:
+ * fast/forms/labels-remove-htmlFor-label.html:
+ * fast/forms/labels-remove-parent-label.html:
+ * fast/forms/labels-set-htmlFor-attribute.html:
+ * fast/forms/listbox-deselect-scroll.html:
+ * fast/forms/listbox-selection-2.html:
+ * fast/forms/listbox-selection.html:
+ * fast/forms/menulist-disabled-selected-option.html:
+ * fast/forms/menulist-submit-without-selection.html:
+ * fast/forms/novalidate-attribute.html:
+ * fast/forms/output-reset-assertion-failed.html:
+ * fast/forms/placeholder-dom-property.html:
+ * fast/forms/script-tests/TEMPLATE.html: Removed.
+ * fast/forms/script-tests/ValidityState-patternMismatch-unsupported.js: Removed.
+ * fast/forms/script-tests/ValidityState-rangeOverflow.js: Removed.
+ * fast/forms/script-tests/ValidityState-rangeUnderflow.js: Removed.
+ * fast/forms/script-tests/ValidityState-stepMismatch.js: Removed.
+ * fast/forms/script-tests/ValidityState-tooLong-input.js: Removed.
+ * fast/forms/script-tests/ValidityState-tooLong-textarea.js: Removed.
+ * fast/forms/script-tests/ValidityState-typeMismatch-date.js: Removed.
+ * fast/forms/script-tests/ValidityState-typeMismatch-url.js: Removed.
+ * fast/forms/script-tests/ValidityState-valueMissing-radio.js: Removed.
+ * fast/forms/script-tests/checkValidity-cancel.js: Removed.
+ * fast/forms/script-tests/checkValidity-handler-updates-dom.js: Removed.
+ * fast/forms/script-tests/form-attribute-elements-order.js: Removed.
+ * fast/forms/script-tests/form-attribute-elements-order2.js: Removed.
+ * fast/forms/script-tests/form-attribute-elements.js: Removed.
+ * fast/forms/script-tests/form-attribute.js: Removed.
+ * fast/forms/script-tests/form-collection-elements-order.js: Removed.
+ * fast/forms/script-tests/form-collection-elements.js: Removed.
+ * fast/forms/script-tests/formnovalidate-attribute.js: Removed.
+ * fast/forms/script-tests/incremental-dom-property.js: Removed.
+ * fast/forms/script-tests/input-maxlength-ime-completed.js: Removed.
+ * fast/forms/script-tests/input-maxlength-ime-preedit.js: Removed.
+ * fast/forms/script-tests/input-maxlength-unsupported.js: Removed.
+ * fast/forms/script-tests/input-minmax.js: Removed.
+ * fast/forms/script-tests/input-pattern.js: Removed.
+ * fast/forms/script-tests/input-step.js: Removed.
+ * fast/forms/script-tests/input-stepup-stepdown.js: Removed.
+ * fast/forms/script-tests/input-type-change3.js: Removed.
+ * fast/forms/script-tests/input-valueasnumber-unsupported.js: Removed.
+ * fast/forms/script-tests/labels-add-htmlFor-label.js: Removed.
+ * fast/forms/script-tests/labels-add-parent-label.js: Removed.
+ * fast/forms/script-tests/labels-change-htmlFor-attribute.js: Removed.
+ * fast/forms/script-tests/labels-item-index.js: Removed.
+ * fast/forms/script-tests/labels-remove-htmlFor-attribute.js: Removed.
+ * fast/forms/script-tests/labels-remove-htmlFor-label.js: Removed.
+ * fast/forms/script-tests/labels-remove-parent-label.js: Removed.
+ * fast/forms/script-tests/labels-set-htmlFor-attribute.js: Removed.
+ * fast/forms/script-tests/listbox-deselect-scroll.js: Removed.
+ * fast/forms/script-tests/listbox-selection-2.js: Removed.
+ * fast/forms/script-tests/listbox-selection.js: Removed.
+ * fast/forms/script-tests/menulist-disabled-selected-option.js: Removed.
+ * fast/forms/script-tests/menulist-submit-without-selection.js: Removed.
+ * fast/forms/script-tests/novalidate-attribute.js: Removed.
+ * fast/forms/script-tests/output-reset-assertion-failed.js: Removed.
+ * fast/forms/script-tests/placeholder-dom-property.js: Removed.
+ * fast/forms/script-tests/search-cancel-button-events.js: Removed.
+ * fast/forms/script-tests/select-set-length-optgroup.js: Removed.
+ * fast/forms/script-tests/select-set-length-with-mutation-remove.js: Removed.
+ * fast/forms/script-tests/select-set-length-with-mutation-reorder.js: Removed.
+ * fast/forms/script-tests/select-set-length-with-mutation-reparent.js: Removed.
+ * fast/forms/script-tests/select-set-length-with-mutation.js: Removed.
+ * fast/forms/script-tests/select-set-length.js: Removed.
+ * fast/forms/script-tests/setCustomValidity-existence.js: Removed.
+ * fast/forms/script-tests/shadow-tree-exposure.js: Removed.
+ * fast/forms/script-tests/submit-form-attributes.js: Removed.
+ * fast/forms/script-tests/text-control-intrinsic-widths.js: Removed.
+ * fast/forms/script-tests/textarea-maxlength.js: Removed.
+ * fast/forms/script-tests/textarea-metrics.js: Removed.
+ * fast/forms/script-tests/textarea-placeholder-dom-property.js: Removed.
+ * fast/forms/script-tests/textarea-rows-cols.js: Removed.
+ * fast/forms/script-tests/textarea-textlength.js: Removed.
+ * fast/forms/script-tests/validationMessage.js: Removed.
+ * fast/forms/script-tests/willvalidate.js: Removed.
+ * fast/forms/search-cancel-button-events.html:
+ * fast/forms/select-set-length-optgroup.html:
+ * fast/forms/select-set-length-with-mutation-remove.html:
+ * fast/forms/select-set-length-with-mutation-reorder.html:
+ * fast/forms/select-set-length-with-mutation-reparent.html:
+ * fast/forms/select-set-length-with-mutation.html:
+ * fast/forms/select-set-length.html:
+ * fast/forms/setCustomValidity-existence.html:
+ * fast/forms/shadow-tree-exposure.html:
+ * fast/forms/submit-form-attributes.html:
+ * fast/forms/text-control-intrinsic-widths.html:
+ * fast/forms/textarea-maxlength.html:
+ * fast/forms/textarea-metrics.html:
+ * fast/forms/textarea-placeholder-dom-property.html:
+ * fast/forms/textarea-rows-cols.html:
+ * fast/forms/textarea-textlength.html:
+ * fast/forms/validationMessage.html:
+ * fast/forms/willvalidate.html:
+
2012-02-14 Noel Gordon <noel.gordon@gmail.com>
[chromium] Rebaseline JPEG image results after r107389
diff --git a/LayoutTests/fast/forms/ValidityState-patternMismatch-unsupported.html b/LayoutTests/fast/forms/ValidityState-patternMismatch-unsupported.html
index e332ad6..b2fd9c6 100644
--- a/LayoutTests/fast/forms/ValidityState-patternMismatch-unsupported.html
+++ b/LayoutTests/fast/forms/ValidityState-patternMismatch-unsupported.html
@@ -6,7 +6,22 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-patternMismatch-unsupported.js"></script>
+<script>
+description('Check if the pattern constraint is not applied to some input types.');
+
+var input = document.createElement('input');
+input.type = 'range';
+input.pattern = '[0-9]'; // Restrict to single digit
+input.value = '11';
+
+// pattern doesn't work for type=range
+shouldBe('input.validity.patternMismatch', 'false');
+
+// works for type=text.
+input.type = 'text';
+shouldBe('input.validity.patternMismatch', 'true');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-rangeOverflow.html b/LayoutTests/fast/forms/ValidityState-rangeOverflow.html
index 71f31af..716988e 100644
--- a/LayoutTests/fast/forms/ValidityState-rangeOverflow.html
+++ b/LayoutTests/fast/forms/ValidityState-rangeOverflow.html
@@ -6,7 +6,31 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-rangeOverflow.js"></script>
+<script>
+description('This test aims to check for rangeOverflow flag with input fields');
+
+var input = document.createElement('input');
+
+function checkNotOverflow(value, max, disabled)
+{
+ input.value = value;
+ input.max = max;
+ input.disabled = !!disabled;
+ var overflow = input.validity.rangeOverflow;
+ var resultText = 'The value "' + input.value + '" ' +
+ (overflow ? 'overflows' : 'doesn\'t overflow') +
+ ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
+ if (overflow)
+ testFailed(resultText);
+ else
+ testPassed(resultText);
+}
+
+// ----------------------------------------------------------------
+debug('Type=text');
+input.type = 'text'; // No overflow for type=text.
+checkNotOverflow('101', '100');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-rangeUnderflow.html b/LayoutTests/fast/forms/ValidityState-rangeUnderflow.html
index f535204..3e530ef 100644
--- a/LayoutTests/fast/forms/ValidityState-rangeUnderflow.html
+++ b/LayoutTests/fast/forms/ValidityState-rangeUnderflow.html
@@ -6,7 +6,31 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-rangeUnderflow.js"></script>
+<script>
+description('This test aims to check for rangeUnderflow flag with input fields');
+
+var input = document.createElement('input');
+
+function checkNotUnderflow(value, min, disabled)
+{
+ input.value = value;
+ input.min = min;
+ input.disabled = !!disabled;
+ var underflow = input.validity.rangeUnderflow;
+ var resultText = 'The value "' + input.value + '" ' +
+ (underflow ? 'underflows' : 'doesn\'t underflow') +
+ ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
+ if (underflow)
+ testFailed(resultText);
+ else
+ testPassed(resultText);
+}
+
+// ----------------------------------------------------------------
+debug('Type=text');
+input.type = 'text'; // No underflow for type=text.
+checkNotUnderflow('99', '100');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-stepMismatch.html b/LayoutTests/fast/forms/ValidityState-stepMismatch.html
index 949999b..376d126 100644
--- a/LayoutTests/fast/forms/ValidityState-stepMismatch.html
+++ b/LayoutTests/fast/forms/ValidityState-stepMismatch.html
@@ -6,7 +6,30 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-stepMismatch.js"></script>
+<script>
+description('Check stepMismatch results for unsupported types.');
+
+var input = document.createElement('input');
+document.body.appendChild(input);
+
+debug('Unsupported types');
+shouldBe('input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "button"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "checkbox"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "color"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "email"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "hidden"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "image"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "khtml_isindex"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "passwd"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "radio"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "reset"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "search"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "submit"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "tel"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "url"; input.validity.stepMismatch', 'false');
+shouldBe('input.type = "file"; input.validity.stepMismatch', 'false');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-tooLong-input.html b/LayoutTests/fast/forms/ValidityState-tooLong-input.html
index 2069e46..78d0ccf 100644
--- a/LayoutTests/fast/forms/ValidityState-tooLong-input.html
+++ b/LayoutTests/fast/forms/ValidityState-tooLong-input.html
@@ -6,7 +6,76 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-tooLong-input.js"></script>
+<script>
+description('Tests for tooLong flag with <input> elements.');
+
+var input = document.createElement('input');
+document.body.appendChild(input);
+
+debug('No maxlength and no value');
+shouldBeFalse('input.validity.tooLong');
+
+debug('');
+debug('Non-dirty value');
+input.setAttribute('value', 'abcde');
+input.maxLength = 3;
+shouldBe('input.value.length', '5');
+shouldBeFalse('input.validity.tooLong');
+
+input.setAttribute('value', 'abcdef');
+shouldBe('input.value.length', '6');
+shouldBeFalse('input.validity.tooLong');
+
+debug('');
+debug('Dirty value and longer than maxLength');
+input = document.createElement('input');
+document.body.appendChild(input);
+input.setAttribute('value', 'abcde');
+input.maxLength = 3;
+input.focus();
+input.setSelectionRange(5, 5); // Move the cursor at the end.
+document.execCommand('delete');
+shouldBe('input.value.length', '4');
+shouldBeTrue('input.validity.tooLong');
+// Make the value <=maxLength.
+document.execCommand('delete');
+shouldBeFalse('input.validity.tooLong');
+
+debug('');
+debug('Sets a value via DOM property');
+input.maxLength = 3;
+input.value = 'abcde';
+shouldBeFalse('input.validity.tooLong');
+
+debug('');
+debug('Disabled');
+input.disabled = true;
+shouldBeFalse('input.validity.tooLong');
+input.disabled = false;
+
+debug('');
+debug('Grapheme length is not greater than maxLength though character length is greater');
+// fancyX should be treated as 1 grapheme.
+// U+0305 COMBINING OVERLINE
+// U+0332 COMBINING LOW LINE
+var fancyX = "x\u0305\u0332";
+input = document.createElement('input');
+document.body.appendChild(input);
+input.value = fancyX; // 3 characters, 1 grapheme clusters.
+input.maxLength = 1;
+shouldBeFalse('input.validity.tooLong');
+
+debug('');
+debug('Change the type with a too long value');
+input.maxLength = 3;
+input.value = 'abcde';
+input.type = 'search';
+input.focus();
+input.setSelectionRange(5, 5);
+document.execCommand('delete');
+shouldBeTrue('input.validity.tooLong');
+shouldBeFalse('input.type = "number"; input.validity.tooLong');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-tooLong-textarea.html b/LayoutTests/fast/forms/ValidityState-tooLong-textarea.html
index 4cd7e68..c9ea2ed 100644
--- a/LayoutTests/fast/forms/ValidityState-tooLong-textarea.html
+++ b/LayoutTests/fast/forms/ValidityState-tooLong-textarea.html
@@ -6,7 +6,91 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-tooLong-textarea.js"></script>
+<script>
+description('Tests for tooLong flag with <textarea> elements.');
+
+var textarea = document.createElement('textarea');
+document.body.appendChild(textarea);
+
+debug('No maxlength and no value');
+shouldBeFalse('textarea.validity.tooLong');
+
+debug('');
+debug('Non-dirty value');
+textarea.defaultValue = 'abcde';
+textarea.maxLength = 3;
+shouldBe('textarea.value.length', '5');
+shouldBeFalse('textarea.validity.tooLong');
+
+textarea.defaultValue = 'abcdef';
+shouldBe('textarea.value.length', '6');
+shouldBeFalse('textarea.validity.tooLong');
+
+debug('');
+debug('Dirty value and longer than maxLength');
+textarea = document.createElement('textarea');
+document.body.appendChild(textarea);
+textarea.defaultValue = 'abcde';
+textarea.maxLength = 3;
+textarea.focus();
+textarea.setSelectionRange(5, 5); // Move the cursor at the end.
+document.execCommand('delete');
+shouldBe('textarea.value.length', '4');
+shouldBeTrue('textarea.validity.tooLong');
+// Make the value <=maxLength.
+document.execCommand('delete');
+shouldBeFalse('textarea.validity.tooLong');
+
+debug('');
+debug('Sets a value via DOM property');
+textarea = document.createElement('textarea');
+document.body.appendChild(textarea);
+textarea.maxLength = 3;
+textarea.value = 'abcde';
+shouldBeFalse('textarea.validity.tooLong');
+
+debug('');
+debug('Disabled');
+textarea.disabled = true;
+shouldBeFalse('textarea.validity.tooLong');
+textarea.disabled = false;
+
+debug('');
+debug('Grapheme length is not greater than maxLength though character length is greater');
+// fancyX should be treated as 1 grapheme.
+// U+0305 COMBINING OVERLINE
+// U+0332 COMBINING LOW LINE
+var fancyX = "x\u0305\u0332";
+textarea = document.createElement('textarea');
+document.body.appendChild(textarea);
+textarea.value = fancyX; // 3 characters, 1 grapheme cluster.
+textarea.maxLength = 1;
+shouldBeFalse('textarea.validity.tooLong');
+
+debug('');
+debug('A value set by resetting a form doesn\'t make tooLong true.');
+// Make a dirty textarea.
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<form><textarea maxlength=2>abcdef</textarea></form>';
+textarea = parent.firstChild.firstChild;
+textarea.focus();
+textarea.setSelectionRange(6, 6);
+document.execCommand('delete');
+shouldBeTrue('textarea.validity.tooLong');
+parent.firstChild.reset();
+shouldBe('textarea.value', '"abcdef"');
+shouldBeFalse('textarea.validity.tooLong');
+
+debug('');
+debug('A value set by a child node change doesn\'t make tooLong true.');
+parent.innerHTML = '<textarea maxlength=2>abc</textarea>';
+textarea = parent.firstChild;
+shouldBeFalse('textarea.validity.tooLong');
+parent.firstChild.innerHTML = 'abcdef';
+shouldBe('textarea.value', '"abcdef"');
+shouldBeFalse('textarea.validity.tooLong');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt
deleted file mode 100644
index 7470ebf..0000000
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-This test aims to check for typeMismatch flag with type=date input fields
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS "" is a correct valid date string.
-PASS "2009-09-07" is a correct valid date string.
-PASS "9999-12-31" is a correct valid date string.
-PASS "275760-09-13" is a correct valid date string.
-PASS "1582-10-15" is a correct valid date string.
-PASS "0001-01-01" is a correct valid date string.
-PASS "2009-01-31" is a correct valid date string.
-PASS "2009-02-28" is a correct valid date string.
-PASS "2009-03-31" is a correct valid date string.
-PASS "2009-04-30" is a correct valid date string.
-PASS "2009-05-31" is a correct valid date string.
-PASS "2009-06-30" is a correct valid date string.
-PASS "2009-07-31" is a correct valid date string.
-PASS "2009-08-31" is a correct valid date string.
-PASS "2009-09-30" is a correct valid date string.
-PASS "2009-10-31" is a correct valid date string.
-PASS "2009-11-30" is a correct valid date string.
-PASS "2009-12-31" is a correct valid date string.
-PASS "2008-02-29" is a correct valid date string.
-PASS "2000-02-29" is a correct valid date string.
-PASS " 2009-09-07 " is a correct invalid date string.
-PASS "a" is a correct invalid date string.
-PASS "-1-09-07" is a correct invalid date string.
-PASS "0000-12-31" is a correct invalid date string.
-PASS "0000-01-01" is a correct invalid date string.
-PASS "275760-09-14" is a correct invalid date string.
-PASS "2147483648-12-31" is a correct invalid date string.
-PASS "2009/09/07" is a correct invalid date string.
-PASS "20090907" is a correct invalid date string.
-PASS "2009--2-07" is a correct invalid date string.
-PASS "2009-00-07" is a correct invalid date string.
-PASS "2009-13-07" is a correct invalid date string.
-PASS "2009-xx-30" is a correct invalid date string.
-PASS "2009-01-32" is a correct invalid date string.
-PASS "2009-02-29" is a correct invalid date string.
-PASS "2009-03-32" is a correct invalid date string.
-PASS "2009-04-31" is a correct invalid date string.
-PASS "2009-05-32" is a correct invalid date string.
-PASS "2009-06-31" is a correct invalid date string.
-PASS "2009-07-32" is a correct invalid date string.
-PASS "2009-08-32" is a correct invalid date string.
-PASS "2009-09-31" is a correct invalid date string.
-PASS "2009-10-32" is a correct invalid date string.
-PASS "2009-11-31" is a correct invalid date string.
-PASS "2009-12-32" is a correct invalid date string.
-PASS "2100-02-29" is a correct invalid date string.
-PASS "2009-09-00" is a correct invalid date string.
-PASS "2009-09-" is a correct invalid date string.
-PASS "2009-09-7" is a correct invalid date string.
-PASS "2009-09-001" is a correct invalid date string.
-PASS "2009-09-xx" is a correct invalid date string.
-PASS "2009-09" is a correct invalid date string.
-PASS "2009" is a correct invalid date string.
-PASS "2009-09" is a correct valid date string when disabled.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-url.html b/LayoutTests/fast/forms/ValidityState-typeMismatch-url.html
index b837a7b..5dd4fd5 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-url.html
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-url.html
@@ -6,7 +6,90 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-typeMismatch-url.js"></script>
+<script>
+description("Input type=url validation test");
+
+function check(value, mismatchExpected, disabled) {
+ i.value = value;
+ i.disabled = !!disabled;
+ var actual = i.validity.typeMismatch;
+ var didPass = actual == mismatchExpected;
+ var resultText = value + ' is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' url' + (disabled ? ' when disabled.' : '.');
+ if (didPass)
+ testPassed(resultText);
+ else
+ testFailed(resultText);
+}
+
+function expectValid(value, disabled) {
+ check(value, false, disabled);
+}
+
+function expectInvalid(value) {
+ check(value, true);
+}
+
+var i = document.createElement('input');
+i.type = 'url';
+
+// Valid values
+expectValid('http://www.google.com');
+expectValid('http://foo:bar@www.google.com:80');
+expectValid('http://localhost');
+expectValid('http://127.0.0.1');
+expectValid('http://[0000:0000:0000:0000:0000:0000:7f00:0001]/');
+expectValid('http://[0000:0000:0000:0000:0000:0000:127.0.0.1]/');
+expectValid('http://[::7f00:0001]/');
+expectValid('http://[1::2:3]/');
+expectValid('http://[0000:0::ffff:10.0.0.1]/');
+expectValid('http://a');
+expectValid('http://www.google.com/search?rls=en&q=WebKit&ie=UTF-8&oe=UTF-8');
+expectValid('ftp://ftp.myhost.com');
+expectValid('ssh://ssh.myhost.com');
+expectValid('mailto:tkent@chromium.org');
+expectValid('mailto:tkent@chromium.org?body=hello');
+expectValid('file:///Users/tkent/.zshrc');
+expectValid('file:///C:/human.sys');
+expectValid('tel:+1-800-12345;ext=9999');
+expectValid('tel:03(1234)5678');
+expectValid('somescheme://ssh.myhost.com');
+expectValid('http://a/\\\/\'\'*<>/');
+expectValid('http://a/dfs/\kds@sds');
+expectValid('http://a.a:1/search?a&b');
+expectValid('http://www.google.com/#top');
+expectValid('http://\u30C6\u30B9\u30C8\u3002jp/\u30D1\u30B9?\u540D\u524D=\u5024');
+
+// Invalid values
+expectInvalid('www.google.com');
+expectInvalid('127.0.0.1');
+expectInvalid('.com');
+expectInvalid('http://www.google.com:aaaa');
+expectInvalid('://');
+expectInvalid('/http://www.google.com');
+expectInvalid('----ftp://a');
+expectInvalid('scheme//a');
+expectInvalid('http://[v8.:::]/');
+
+// KURL's host name restriction is stricter than RFC 3986. KURLGoogle is not.
+i.value = 'http://www.g**gle.com'
+var strictHost = i.validity.typeMismatch;
+if (strictHost) {
+ expectInvalid('http:// www.google.com');
+ expectInvalid('http://www .google.com');
+ expectInvalid('http://www. google. com');
+ expectInvalid('http://host+');
+ expectInvalid('http://myurl!');
+} else {
+ expectValid('http:// www.google.com');
+ expectValid('http://www .google.com');
+ expectValid('http://www. google. com');
+ expectValid('http://host+');
+ expectValid('http://myurl!');
+}
+
+// Disabled
+expectValid('invalid', true);
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/ValidityState-valueMissing-radio.html b/LayoutTests/fast/forms/ValidityState-valueMissing-radio.html
index 13a0fbf..4f4140b 100644
--- a/LayoutTests/fast/forms/ValidityState-valueMissing-radio.html
+++ b/LayoutTests/fast/forms/ValidityState-valueMissing-radio.html
@@ -6,7 +6,84 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/ValidityState-valueMissing-radio.js"></script>
+<script>
+description('valueMissing tests for radio buttons');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+
+debug('Without form element');
+parent.innerHTML = '<input name=victim type=radio required>'
+ + '<input name=victim type=radio>'
+ + '<input name=victim type=radio>';
+var inputs = document.getElementsByName('victim');
+debug('No checked button:');
+shouldBeTrue('inputs[0].validity.valueMissing');
+shouldBeTrue('inputs[1].validity.valueMissing');
+shouldBeTrue('inputs[2].validity.valueMissing');
+debug('The second button has been checked:');
+inputs[1].checked = true;
+shouldBeFalse('inputs[0].validity.valueMissing');
+shouldBeFalse('inputs[1].validity.valueMissing');
+shouldBeFalse('inputs[2].validity.valueMissing');
+debug('The first button has been checked:');
+inputs[0].checked = true;
+shouldBeFalse('inputs[0].validity.valueMissing');
+shouldBeFalse('inputs[1].validity.valueMissing');
+shouldBeFalse('inputs[2].validity.valueMissing');
+debug('The third button has been checked:');
+inputs[2].checked = true;
+shouldBeFalse('inputs[0].validity.valueMissing');
+shouldBeFalse('inputs[1].validity.valueMissing');
+shouldBeFalse('inputs[2].validity.valueMissing');
+
+debug('');
+debug('With form element');
+parent.innerHTML = '<form>'
+ + '<input name=victim type=radio required>'
+ + '<input name=victim type=radio>'
+ + '<input name=victim type=radio>'
+ + '</form>';
+inputs = document.getElementsByName('victim');
+debug('No checked button:');
+shouldBeTrue('inputs[0].validity.valueMissing');
+shouldBeTrue('inputs[1].validity.valueMissing');
+shouldBeTrue('inputs[2].validity.valueMissing');
+debug('The first button has been checked:');
+inputs[0].checked = true;
+shouldBeFalse('inputs[0].validity.valueMissing');
+shouldBeFalse('inputs[1].validity.valueMissing');
+shouldBeFalse('inputs[2].validity.valueMissing');
+debug('The second button has been checked:');
+inputs[1].checked = true;
+shouldBeFalse('inputs[0].validity.valueMissing');
+shouldBeFalse('inputs[1].validity.valueMissing');
+shouldBeFalse('inputs[2].validity.valueMissing');
+debug('The third button has been checked:');
+inputs[2].checked = true;
+shouldBeFalse('inputs[0].validity.valueMissing');
+shouldBeFalse('inputs[1].validity.valueMissing');
+shouldBeFalse('inputs[2].validity.valueMissing');
+
+debug('');
+debug('Not in a radio button group');
+var requiredButton = document.createElement('input');
+requiredButton.type = 'radio';
+requiredButton.name = 'victim';
+requiredButton.required = true;
+shouldBeFalse('requiredButton.validity.valueMissing');
+
+parent.innerHTML = '<input name=victim type=radio required><input name=victim type=radio>';
+requiredButton = document.getElementsByName('victim')[0];
+var button = document.getElementsByName('victim')[1];
+shouldBeTrue('requiredButton.validity.valueMissing');
+shouldBeTrue('button.validity.valueMissing');
+parent.removeChild(button);
+shouldBeFalse('button.validity.valueMissing');
+parent.removeChild(requiredButton);
+shouldBeFalse('requiredButton.validity.valueMissing');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/checkValidity-cancel.html b/LayoutTests/fast/forms/checkValidity-cancel.html
index 9b965ee..450f212 100644
--- a/LayoutTests/fast/forms/checkValidity-cancel.html
+++ b/LayoutTests/fast/forms/checkValidity-cancel.html
@@ -6,7 +6,38 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/checkValidity-cancel.js"></script>
+<script>
+description('Tests for checkValidity() with invalid event canceling');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<form><input name=i required></form>';
+var form = parent.firstChild;
+var input = form.firstChild;
+
+debug('"invalid" event is not canceled.');
+var invalidFired = false;
+var nothingListener = {};
+nothingListener.handleEvent = function(event) {
+ invalidFired = true;
+};
+shouldBeTrue('input.addEventListener("invalid", nothingListener, false); !input.checkValidity() && invalidFired');
+shouldBeTrue('invalidFired = false; !form.checkValidity() && invalidFired');
+input.removeEventListener('invalid', nothingListener, false);
+
+debug('');
+debug('"invalid" event is canceled.');
+invalidFired = false;
+var cancelListener = {};
+cancelListener.handleEvent = function(event) {
+ invalidFired = true;
+ event.preventDefault();
+};
+// Even if 'invalid' is canceled, the input.checkValidity() result is still false.
+shouldBeTrue('input.addEventListener("invalid", cancelListener, false); !input.checkValidity() && invalidFired');
+// form.checkValidity() also should be false.
+shouldBeTrue('invalidFired = false; !form.checkValidity() && invalidFired');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/checkValidity-handler-updates-dom.html b/LayoutTests/fast/forms/checkValidity-handler-updates-dom.html
index 5236dc8..7bb2c66 100644
--- a/LayoutTests/fast/forms/checkValidity-handler-updates-dom.html
+++ b/LayoutTests/fast/forms/checkValidity-handler-updates-dom.html
@@ -6,7 +6,94 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/checkValidity-handler-updates-dom.js"></script>
+<script>
+description('HTMLFormElement::checkValidity() with cases that event handlers called by checkValidity() updates DOM structure.')
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+
+// ----------------------------------------------------------------
+debug('The target form is removed.');
+parent.innerHTML = '<form id=f1><input name=i id=i required></form>';
+var handler = function(event) {
+ parent.innerHTML = '';
+};
+document.getElementById('i').addEventListener('invalid', handler, false);
+// The specificiation doesn't define the behavior in this case.
+// It's ok if WebKit doesn't crash.
+shouldBeFalse('document.getElementById("f1").checkValidity()');
+
+// ----------------------------------------------------------------
+debug('');
+debug('A control to be checked is removed.');
+parent.innerHTML = '<form id=f1><input name=i1 id=i1 required><input name=i2 id=i2 required></form>';
+var handler1 = function(event) {
+ document.getElementById('f1').removeChild(document.getElementById('i2'));
+};
+document.getElementById('i1').addEventListener('invalid', handler1, false);
+var handler2Called = false;
+var handler2 = function(event) {
+ handler2Called = true;
+};
+document.getElementById('i2').addEventListener('invalid', handler2, false);
+shouldBeFalse('document.getElementById("f1").checkValidity()');
+// If the node was removed from the form, i2.checkValidity() is called, but an
+// invalid event is not fired because it is not in any documents.
+shouldBeFalse('handler2Called');
+
+// ----------------------------------------------------------------
+debug('');
+debug('A new control is added.');
+parent.innerHTML = '<form id=f1><input name=i1 id=i1 required></form>';
+handler2Called = false;
+handler2 = function(event) {
+ handler2Called = true;
+};
+handler1 = function(event) {
+ var input = document.createElement('input');
+ input.name = 'i2';
+ input.required = true;
+ input.addEventListener('invalid', handler2, false);
+ document.getElementById('f1').appendChild(input);
+};
+document.getElementById('i1').addEventListener('invalid', handler1, false);
+shouldBeFalse('document.getElementById("f1").checkValidity()');
+// If a new node is added to the form, checkValidity() doesn't handle it.
+shouldBeFalse('handler2Called');
+
+// ----------------------------------------------------------------
+debug('');
+debug('A control is moved to another form.');
+parent.innerHTML = '<form id=f1><input name=i1 id=i1 required><input name=i2 id=i2 required></form>'
+ + '<form id=f2></form>';
+handler1 = function(event) {
+ document.getElementById('f2').appendChild(document.getElementById('i2'));
+};
+document.getElementById('i1').addEventListener('invalid', handler1, false);
+handler2Called = false;
+handler2 = function(event) {
+ handler2Called = true;
+};
+document.getElementById('i2').addEventListener('invalid', handler2, false);
+shouldBeFalse('document.getElementById("f1").checkValidity()');
+// The moved control is not checked.
+shouldBeFalse('handler2Called');
+
+// ----------------------------------------------------------------
+debug('');
+debug('A control is moved to another document.');
+parent.innerHTML = '<form id=f1><input name=i1 id=i1 required></form>';
+var doc2 = document.implementation.createHTMLDocument();
+handler1 = function(event) {
+ doc2.body.appendChild(doc2.adoptNode(document.getElementById('i1')));
+};
+document.getElementById('i1').addEventListener('invalid', handler1, false);
+// i1 is not listed in 'unhandled invalid controls' because it was moved to
+// another document.
+shouldBeTrue('document.getElementById("f1").checkValidity()');
+
+parent.innerHTML = '';
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/form-attribute-elements-order.html b/LayoutTests/fast/forms/form-attribute-elements-order.html
index 92654fe..d28420e 100644
--- a/LayoutTests/fast/forms/form-attribute-elements-order.html
+++ b/LayoutTests/fast/forms/form-attribute-elements-order.html
@@ -6,7 +6,159 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/form-attribute-elements-order.js"></script>
+<script>
+description("This test examines the order of the elements attribute of a form element.");
+
+var container = document.createElement('div');
+document.body.appendChild(container);
+container.innerHTML = '<input name=victim id=before1 form=owner />' +
+ '<input name=victim id=before2 form=owner />' +
+ '<form id=owner action= method=GET>' +
+ ' <input name=victim id=inner1 form=owner />' +
+ ' <input name=victim id=inner2 form=owner />' +
+ '</form>' +
+ '<input name=victim id=after1 form=owner />' +
+ '<input name=victim id=after2 form=owner />';
+
+var owner = document.getElementById('owner');
+var before1 = document.getElementById('before1');
+var before2 = document.getElementById('before2');
+var inner1 = document.getElementById('inner1');
+var inner2 = document.getElementById('inner2');
+var after1 = document.getElementById('after1');
+var after2 = document.getElementById('after2');
+
+debug('- Test for the case where some elements are outside of the form.');
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+
+debug('');
+debug('- Test for changing the value of the form attribute of a element which is located before the form owner.');
+before2.attributes['form'].value = '';
+shouldBe('owner.elements.length', '5');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'inner1');
+shouldBe('owner.elements[2]', 'inner2');
+shouldBe('owner.elements[3]', 'after1');
+shouldBe('owner.elements[4]', 'after2');
+before2.attributes['form'].value = 'owner';
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+
+debug('');
+debug('- Test for changing the value of the form attribute of a element which is located inside of the form owner.');
+inner2.attributes['form'].value = '';
+shouldBe('owner.elements.length', '5');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'after1');
+shouldBe('owner.elements[4]', 'after2');
+inner2.attributes['form'].value = 'owner';
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+
+debug('');
+debug('- Test for changing the value of the form attribute of a element which is located after the form owner.');
+after1.attributes['form'].value = '';
+shouldBe('owner.elements.length', '5');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after2');
+after1.attributes['form'].value = 'owner';
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+
+debug('');
+debug('- Test for setting form attribute of elements in reverse order.');
+before1.attributes['form'].value = '';
+before2.attributes['form'].value = '';
+inner1.attributes['form'].value = '';
+inner2.attributes['form'].value = '';
+after1.attributes['form'].value = '';
+after2.attributes['form'].value = '';
+
+after2.attributes['form'].value = 'owner';
+after1.attributes['form'].value = 'owner';
+inner2.attributes['form'].value = 'owner';
+inner1.attributes['form'].value = 'owner';
+before2.attributes['form'].value = 'owner';
+before1.attributes['form'].value = 'owner';
+
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+
+debug('');
+debug('- Test for setting form attribute of elements in random order.');
+before1.attributes['form'].value = '';
+before2.attributes['form'].value = '';
+inner1.attributes['form'].value = '';
+inner2.attributes['form'].value = '';
+after1.attributes['form'].value = '';
+after2.attributes['form'].value = '';
+
+after1.attributes['form'].value = 'owner';
+before1.attributes['form'].value = 'owner';
+inner2.attributes['form'].value = 'owner';
+before2.attributes['form'].value = 'owner';
+after2.attributes['form'].value = 'owner';
+inner1.attributes['form'].value = 'owner';
+
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+
+debug('');
+debug('- Test for removing/adding elements');
+container.removeChild(before2);
+owner.removeChild(inner2);
+container.removeChild(after1);
+shouldBe('owner.elements.length', '3');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'inner1');
+shouldBe('owner.elements[2]', 'after2');
+container.insertBefore(before2, owner);
+owner.appendChild(inner2);
+container.insertBefore(after1, after2);
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before1');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner1');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after1');
+shouldBe('owner.elements[5]', 'after2');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/form-attribute-elements-order2.html b/LayoutTests/fast/forms/form-attribute-elements-order2.html
index 371312b..384ed72 100644
--- a/LayoutTests/fast/forms/form-attribute-elements-order2.html
+++ b/LayoutTests/fast/forms/form-attribute-elements-order2.html
@@ -6,7 +6,104 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/form-attribute-elements-order2.js"></script>
+<script>
+description("This test examines the order of the elements attribute of a form element with form-associated elements with form attribute or witout form attibute.");
+
+var container = document.createElement('div');
+document.body.appendChild(container);
+
+debug('');
+debug('- Test for the case where some elements have form attribute but some others not.');
+container.innerHTML = '<form id=owner>' +
+ ' <input id=input1 name=victim />' +
+ ' <input id=input2 name=victim form=owner />' +
+ ' <input id=input3 name=victim />' +
+ '</form>';
+var owner = document.getElementById('owner');
+var input1 = document.getElementById('input1');
+var input2 = document.getElementById('input2');
+var input3 = document.getElementById('input3');
+shouldBe('owner.elements.length', '3');
+shouldBe('owner.elements[0]', 'input1');
+shouldBe('owner.elements[1]', 'input2');
+shouldBe('owner.elements[2]', 'input3');
+
+container.innerHTML = '<form id=owner>' +
+ ' <input id=input1 name=victim form=owner />' +
+ ' <input id=input2 name=victim />' +
+ ' <input id=input3 name=victim form=owner />' +
+ '</form>';
+owner = document.getElementById('owner');
+input1 = document.getElementById('input1');
+input2 = document.getElementById('input2');
+input3 = document.getElementById('input3');
+shouldBe('owner.elements.length', '3');
+shouldBe('owner.elements[0]', 'input1');
+shouldBe('owner.elements[1]', 'input2');
+shouldBe('owner.elements[2]', 'input3');
+
+debug('');
+debug('- Test for inserting/removing a form-associated element without form attribute.');
+container.innerHTML = '<input name=victim id=before form=owner />' +
+ '<form id=owner action= method=GET>' +
+ ' <input name=victim id=inner />' +
+ '</form>' +
+ '<input name=victim id=after form=owner />';
+owner = document.getElementById('owner');
+var before = document.getElementById('before');
+var inner = document.getElementById('inner');
+var after = document.getElementById('after');
+
+var inner2 = document.createElement('input');
+inner2.name = 'victim';
+inner2.id = 'inner2';
+owner.appendChild(inner2);
+shouldBe('owner.elements.length', '4');
+shouldBe('owner.elements[0]', 'before');
+shouldBe('owner.elements[1]', 'inner');
+shouldBe('owner.elements[2]', 'inner2');
+shouldBe('owner.elements[3]', 'after');
+
+owner.removeChild(inner);
+owner.insertBefore(inner, inner2);
+shouldBe('owner.elements.length', '4');
+shouldBe('owner.elements[0]', 'before');
+shouldBe('owner.elements[1]', 'inner');
+shouldBe('owner.elements[2]', 'inner2');
+shouldBe('owner.elements[3]', 'after');
+
+debug('');
+debug('- Test for inserting/removing a form-associated element with form attribute.');
+var before2 = document.createElement('input');
+before2.name = 'victim';
+before2.id = 'before2';
+before2.setAttribute('form', 'owner');
+container.insertBefore(before2, owner);
+var after2 = document.createElement('input');
+after2.name = 'victim';
+after2.id = 'after2';
+after2.setAttribute('form', 'owner');
+container.appendChild(after2);
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after');
+shouldBe('owner.elements[5]', 'after2');
+
+container.removeChild(before);
+container.removeChild(after);
+container.insertBefore(before, before2);
+container.insertBefore(after, after2);
+shouldBe('owner.elements.length', '6');
+shouldBe('owner.elements[0]', 'before');
+shouldBe('owner.elements[1]', 'before2');
+shouldBe('owner.elements[2]', 'inner');
+shouldBe('owner.elements[3]', 'inner2');
+shouldBe('owner.elements[4]', 'after');
+shouldBe('owner.elements[5]', 'after2');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/form-attribute-elements.html b/LayoutTests/fast/forms/form-attribute-elements.html
index 512a1cd..7523b43 100644
--- a/LayoutTests/fast/forms/form-attribute-elements.html
+++ b/LayoutTests/fast/forms/form-attribute-elements.html
@@ -6,7 +6,48 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/form-attribute-elements.js"></script>
+<script>
+description("This test checks a form element can handle elements of which form attribute points the form element even if elements are outside of the form.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var container = document.createElement('div');
+document.body.appendChild(container);
+
+container.innerHTML = '<input type=hidden name=key1 value=value1 id=outer-before form=owner />' +
+ '<form id=owner action="" method="GET">' +
+ ' <input type=hidden name=key2 value=value2 id=inner form=owner />' +
+ '</form>' +
+ '<input type=hidden name=submitted value=true id=outer-after form=owner />';
+
+var owner = document.getElementById('owner');
+var outerBefore = document.getElementById('outer-before');
+var inner = document.getElementById('inner');
+var outerAfter = document.getElementById('outer-after');
+var query = window.location.search;
+
+if (query.indexOf('submitted=true') == -1) {
+ owner.submit();
+} else {
+ debug('- Ensures that elements attribute of the form contains elements which are outside of the form.');
+
+ shouldBe('owner.elements.length', '3');
+ shouldBe('owner.elements[0]', 'outerBefore');
+ shouldBe('owner.elements[1]', 'inner');
+ shouldBe('owner.elements[2]', 'outerAfter');
+
+ debug('');
+ debug('- Ensures that form submission contains name and value pairs for such elements.');
+ var pairs = query.substr(1).split('&');
+ shouldBe('pairs.length', '3');
+ shouldBeEqualToString('pairs[0]', 'key1=value1');
+ shouldBeEqualToString('pairs[1]', 'key2=value2');
+ shouldBeEqualToString('pairs[2]', 'submitted=true');
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/form-attribute.html b/LayoutTests/fast/forms/form-attribute.html
index b1dd0ac..b38f6df 100644
--- a/LayoutTests/fast/forms/form-attribute.html
+++ b/LayoutTests/fast/forms/form-attribute.html
@@ -6,7 +6,141 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/form-attribute.js"></script>
+<script>
+description("This test checks the form attribute of the form-associated elements.");
+
+var container = document.createElement('div');
+document.body.appendChild(container);
+
+debug('- Checks the existence of the form attribute for each form-associated elements.');
+debug('FIXME: <label> doesn\'t support the form attribute for now.');
+container.innerHTML = '<form id=owner></form>' +
+ '<button name=victim form=owner />' +
+ '<fieldset name=victim form=owner />' +
+ '<input name=victim form=owner />' +
+ '<keygen name=victim form=owner />' +
+ '<label name=victim form=owner />' +
+ '<meter name=victim form=owner />' +
+ '<object name=victim form=owner></object>' +
+ '<output name=victim form=owner />' +
+ '<progress name=victim form=owner />' +
+ '<select name=victim form=owner />' +
+ '<textarea name=victim form=owner />';
+
+var owner = document.getElementById('owner');
+shouldBe('document.getElementsByTagName("button")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("fieldset")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("input")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("keygen")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("label")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("meter")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("object")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("output")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("progress")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("select")[0].form', 'owner');
+shouldBe('document.getElementsByTagName("textarea")[0].form', 'owner');
+
+debug('');
+debug('- Ensures that the form attribute points the form owner even if the element is within another form element.');
+container.innerHTML = '<form id=owner></form>' +
+ '<form id=shouldNotBeOwner>' +
+ ' <input id=inputElement name=victim form=owner />' +
+ '</form>';
+owner = document.getElementById('owner');
+var inputElement = document.getElementById('inputElement');
+shouldBe('inputElement.form', 'owner');
+
+debug('');
+debug('- Ensures that the form attribute of all form-associated element with or witout form attribute points the form owner.');
+container.innerHTML = '<form id=owner>' +
+ ' <input id=inputElement1 name=victim />' +
+ ' <input id=inputElement2 name=victim form=owner />' +
+ ' <input id=inputElement3 name=victim />' +
+ '</form>';
+owner = document.getElementById('owner');
+var inputElement1 = document.getElementById('inputElement1');
+var inputElement2 = document.getElementById('inputElement2');
+var inputElement3 = document.getElementById('inputElement3');
+shouldBe('inputElement1.form', 'owner');
+shouldBe('inputElement2.form', 'owner');
+shouldBe('inputElement3.form', 'owner');
+
+debug('');
+debug('- Ensures that the form attribute points the form owner even if the form element is nested another form element.');
+debug('NOTE: It seems that nesting form elements is not allowed so we ensure each form-associated elements associate with the outmost form element.');
+container.innerHTML = '<form id=owner>' +
+ ' <form>' +
+ ' <input id=inputElement1 name=victim form=owner />' +
+ ' <input id=inputElement2 name=victim />' +
+ ' <input id=inputElement3 name=victim form=owner />' +
+ ' </form>' +
+ '</form>';
+owner = document.getElementById('owner');
+inputElement1 = document.getElementById('inputElement1');
+inputElement2 = document.getElementById('inputElement2');
+inputElement3 = document.getElementById('inputElement3');
+shouldBe('inputElement1.form', 'owner');
+shouldBe('inputElement2.form', 'owner');
+shouldBe('inputElement3.form', 'owner');
+
+debug('');
+debug('- Ensures whether the form owner is set correctly when the value of form attribute of a form-associated element changed.');
+container.innerHTML = '<form id=form1></form>' +
+ '<form id=form2></form>' +
+ '<input id=inputElement name=victim form=form1 />' +
+ '<object id=objectElement name=victim form=form1></object>';
+var form1 = document.getElementById('form1');
+var form2 = document.getElementById('form2');
+inputElement = document.getElementById('inputElement');
+shouldBe('inputElement.form', 'form1');
+inputElement.attributes['form'].value = 'form2';
+shouldBe('inputElement.form', 'form2');
+
+// HTMLObjectElement has its own implementation of formAttr processing and so needs its own test.
+objectElement = document.getElementById('objectElement');
+shouldBe('objectElement.form', 'form1');
+objectElement.attributes['form'].value = 'form2';
+shouldBe('objectElement.form', 'form2');
+
+debug('');
+debug('- Ensures whether the form owner is set correctly when the value of form attribute is added/removed.');
+container.innerHTML = '<form id=owner name=firstOwner></form>' +
+ '<input id=inputElement name=victim />' +
+ '<object id=objectElement name=victim></object>';
+owner = document.getElementById('owner');
+inputElement = document.getElementById('inputElement');
+shouldBe('inputElement.form', 'null');
+var formAttribute = document.createAttribute('form');
+inputElement.setAttribute('form', 'owner');
+shouldBe('inputElement.form', 'owner');
+inputElement.removeAttribute('form');
+shouldBe('inputElement.form', 'null');
+
+// HTMLObjectElement has its own implementation of formAttr processing and so needs its own test.
+objectElement = document.getElementById('objectElement');
+shouldBe('objectElement.form', 'null');
+objectElement.setAttribute('form', 'owner');
+shouldBe('objectElement.form', 'owner');
+objectElement.removeAttribute('form');
+shouldBe('objectElement.form', 'null');
+
+debug('');
+debug('- Ensures whether the form owner is set correctly when the form owner is added/removed.');
+container.innerHTML = '<form id=owner name=firstOwner></form>' +
+ '<form id=owner name=secondOwner></form>' +
+ '<input id=inputElement name=victim form=owner />';
+owner = document.getElementById('owner');
+shouldBeEqualToString('owner.name', 'firstOwner');
+inputElement = document.getElementById('inputElement');
+container.removeChild(owner);
+owner = document.getElementById('owner');
+shouldBeEqualToString('owner.name', 'secondOwner');
+shouldBe('inputElement.form', 'owner');
+container.removeChild(owner);
+shouldBe('inputElement.form', 'null');
+container.appendChild(owner);
+shouldBe('inputElement.form', 'owner');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/form-collection-elements-order.html b/LayoutTests/fast/forms/form-collection-elements-order.html
index 5853511..d2b6f7f 100644
--- a/LayoutTests/fast/forms/form-collection-elements-order.html
+++ b/LayoutTests/fast/forms/form-collection-elements-order.html
@@ -6,7 +6,106 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/form-collection-elements-order.js"></script>
+<script>
+description("This test examines the order of form associated elements which are classified as 'listed'.");
+
+var container = document.createElement('div');
+document.body.appendChild(container);
+var owner;
+
+function checkOrder(victims) {
+ if (owner.elements.length != victims.length)
+ return 'length mismatch, elements.length = ' + owner.elements.length +
+ ', expected length = ' + victims.length;
+ for (var i = 0; i < victims.length; ++i)
+ if (owner.elements[i] != victims[i])
+ return 'element mismatch at index ' + i;
+ return 'OK';
+}
+
+debug('- Checks the order of form associated elements.');
+container.innerHTML = '<form id=owner>' +
+ '<button name=victim></button>' +
+ '<fieldset name=victim>Test</fieldset>' +
+ '<input name=victim/>' +
+ '<keygen name=victim></keygen>' +
+ '<label name=victim></label>' +
+ '<meter name=victim></meter>' +
+ '<object name=victim></object>' +
+ '<output name=victim></output>' +
+ '<progress name=victim></progress>' +
+ '<select name=victim></select>' +
+ '<textarea name=victim></textarea>'+
+ '</form>';
+owner = document.getElementById('owner');
+var button = document.getElementsByTagName('button')[0];
+var fieldset = document.getElementsByTagName('fieldset')[0];
+var input = document.getElementsByTagName('input')[0];
+var keygen = document.getElementsByTagName('keygen')[0];
+var label = document.getElementsByTagName('label')[0];
+var meter = document.getElementsByTagName('meter')[0];
+var object = document.getElementsByTagName('object')[0];
+var output = document.getElementsByTagName('output')[0];
+var progress = document.getElementsByTagName('progress')[0];
+var select = document.getElementsByTagName('select')[0];
+var textarea = document.getElementsByTagName('textarea')[0];
+shouldBe('checkOrder([button, fieldset, input, keygen, object, output, select, textarea])', '"OK"');
+
+debug('');
+debug('- Checks the order after some elements removed/inserted.');
+owner.removeChild(object);
+shouldBe('checkOrder([button, fieldset, input, keygen, output, select, textarea])', '"OK"');
+owner.removeChild(button);
+shouldBe('checkOrder([fieldset, input, keygen, output, select, textarea])', '"OK"');
+owner.insertBefore(object, fieldset);
+shouldBe('checkOrder([object, fieldset, input, keygen, output, select, textarea])', '"OK"');
+owner.appendChild(button);
+shouldBe('checkOrder([object, fieldset, input, keygen, output, select, textarea, button])', '"OK"');
+
+debug('');
+debug('- Checks the order of form associated elements with form attribute.');
+container.innerHTML = '<button name=victim form=owner></button>' +
+ '<fieldset name=victim form=owner>Test</fieldset>' +
+ '<input name=victim form=owner />' +
+ '<keygen name=victim form=owner></keygen>' +
+ '<form id=owner>' +
+ '<label name=victim></label>' +
+ '<meter name=victim></meter>' +
+ '<object name=victim></object>' +
+ '</form>' +
+ '<output name=victim form=owner></output>' +
+ '<progress name=victim form=owner></progress>' +
+ '<select name=victim form=owner></select>' +
+ '<textarea name=victim form=owner></textarea>';
+owner = document.getElementById('owner');
+button = document.getElementsByTagName('button')[0];
+fieldset = document.getElementsByTagName('fieldset')[0];
+input = document.getElementsByTagName('input')[0];
+keygen = document.getElementsByTagName('keygen')[0];
+label = document.getElementsByTagName('label')[0];
+meter = document.getElementsByTagName('meter')[0];
+object = document.getElementsByTagName('object')[0];
+output = document.getElementsByTagName('output')[0];
+progress = document.getElementsByTagName('progress')[0];
+select = document.getElementsByTagName('select')[0];
+textarea = document.getElementsByTagName('textarea')[0];
+shouldBe('checkOrder([button, fieldset, input, keygen, object, output, select, textarea])', '"OK"');
+
+debug('');
+debug('- Checks the order after some elements removed/inserted with form attribute.');
+owner.removeChild(object);
+shouldBe('checkOrder([button, fieldset, input, keygen, output, select, textarea])', '"OK"');
+container.removeChild(button);
+shouldBe('checkOrder([fieldset, input, keygen, output, select, textarea])', '"OK"');
+container.removeChild(textarea);
+shouldBe('checkOrder([fieldset, input, keygen, output, select])', '"OK"');
+owner.appendChild(object);
+shouldBe('checkOrder([fieldset, input, keygen, object, output, select])', '"OK"');
+container.insertBefore(textarea, fieldset);
+shouldBe('checkOrder([textarea, fieldset, input, keygen, object, output, select])', '"OK"');
+container.appendChild(button);
+shouldBe('checkOrder([textarea, fieldset, input, keygen, object, output, select, button])', '"OK"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/form-collection-elements.html b/LayoutTests/fast/forms/form-collection-elements.html
index adbf8b4..55d794c 100644
--- a/LayoutTests/fast/forms/form-collection-elements.html
+++ b/LayoutTests/fast/forms/form-collection-elements.html
@@ -6,7 +6,73 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/form-collection-elements.js"></script>
+<script>
+description("This test lists all the elements of a form per http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-listed.");
+debug("This test does not add object element as a listed element. Separate test will cover that.");
+
+var container = document.createElement('div');
+document.body.appendChild(container);
+
+container.innerHTML = '<form id="form1">' +
+ '<button id=button1></button>' +
+ '<fieldset id=fieldset1><legend id=legend1></legend></fieldset>' +
+ '<input id=inputhidden type=hidden>' +
+ '<input id=inputtext type=text>' +
+ '<input id=inputsearch type=search>' +
+ '<input id=inputurl type=url>' +
+ '<input id=inputemail type=email>' +
+ '<input id=inputpassword type=password>' +
+ '<input id=inputdate type=date>' +
+ '<input id=inputnumber type=number>' +
+ '<input id=inputrange type=range>' +
+ '<input id=inputcolor type=color>' +
+ '<input id=inputcheckbox type=checkbox>' +
+ '<input id=inputradio type=radio>' +
+ '<input id=inputfile type=file>' +
+ '<input id=inputsubmit type=submit>' +
+ '<input id=inputimage type=image>' +
+ '<input id=inputreset type=reset>' +
+ '<input id=inputbutton type=button>' +
+ '<keygen id=keygen1></keygen>' +
+ '<label id=label1></label>' +
+ '<meter id=meter1></meter>' +
+ '<object id=object1></object>' +
+ '<output id=output1></output>' +
+ '<progress id=progress1></progress>' +
+ '<select id=select1>' +
+ ' <optgroup id=optgroup1>group1</optgroup>' +
+ ' <option id=option1>option1</option>' +
+ '</select>' +
+ '<textarea id=textarea1></textarea>' +
+ '</form>';
+
+var owner = document.getElementById('form1');
+
+shouldBe('owner.elements.length', '23');
+shouldBe('owner.elements[0].id', "'button1'");
+shouldBe('owner.elements[1].id', "'fieldset1'");
+shouldBe('owner.elements[2].id', "'inputhidden'");
+shouldBe('owner.elements[3].id', "'inputtext'");
+shouldBe('owner.elements[4].id', "'inputsearch'");
+shouldBe('owner.elements[5].id', "'inputurl'");
+shouldBe('owner.elements[6].id', "'inputemail'");
+shouldBe('owner.elements[7].id', "'inputpassword'");
+shouldBe('owner.elements[8].id', "'inputdate'");
+shouldBe('owner.elements[9].id', "'inputnumber'");
+shouldBe('owner.elements[10].id', "'inputrange'");
+shouldBe('owner.elements[11].id', "'inputcolor'");
+shouldBe('owner.elements[12].id', "'inputcheckbox'");
+shouldBe('owner.elements[13].id', "'inputradio'");
+shouldBe('owner.elements[14].id', "'inputfile'");
+shouldBe('owner.elements[15].id', "'inputsubmit'");
+shouldBe('owner.elements[16].id', "'inputreset'");
+shouldBe('owner.elements[17].id', "'inputbutton'");
+shouldBe('owner.elements[18].id', "'keygen1'");
+shouldBe('owner.elements[19].id', "'object1'");
+shouldBe('owner.elements[20].id', "'output1'");
+shouldBe('owner.elements[21].id', "'select1'");
+shouldBe('owner.elements[22].id', "'textarea1'");
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/formnovalidate-attribute.html b/LayoutTests/fast/forms/formnovalidate-attribute.html
index 70ab158..76f4eda 100644
--- a/LayoutTests/fast/forms/formnovalidate-attribute.html
+++ b/LayoutTests/fast/forms/formnovalidate-attribute.html
@@ -6,7 +6,49 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/formnovalidate-attribute.js"></script>
+<script>
+description("This test performs some simple check on the formnovalidate attribute.");
+
+var i = document.createElement("input");
+var b = document.createElement("button");
+
+shouldBe("i.hasAttribute('formNoValidate')", "false");
+shouldBe("i.getAttribute('formNoValidate')", "null");
+shouldBe("i.formNoValidate", "false");
+shouldBe("b.hasAttribute('formNoValidate')", "false");
+shouldBe("b.getAttribute('formNoValidate')", "null");
+shouldBe("b.formNoValidate", "false");
+
+i.formNoValidate = true;
+b.formNoValidate = true;
+
+shouldBe("i.hasAttribute('formNoValidate')", "true");
+shouldBe("i.getAttribute('formNoValidate')", "''");
+shouldBe("i.formNoValidate", "true");
+shouldBe("b.hasAttribute('formNoValidate')", "true");
+shouldBe("b.getAttribute('formNoValidate')", "''");
+shouldBe("b.formNoValidate", "true");
+
+var i2 = document.createElement("input");
+i2.formNoValidate = i.formNoValidate;
+
+i.formNoValidate = false;
+b.formNoValidate = false;
+
+shouldBe("i.hasAttribute('formNoValidate')", "false");
+shouldBe("i.getAttribute('formNoValidate')", "null");
+shouldBe("i.formNoValidate", "false");
+shouldBe("b.hasAttribute('formNoValidate')", "false");
+shouldBe("b.getAttribute('formNoValidate')", "null");
+shouldBe("b.formNoValidate", "false");
+
+i2.formNoValidate = false;
+shouldBe("i2.formNoValidate", "false");
+i2.formNoValidate = "something";
+shouldBe("i2.hasAttribute('formNoValidate')", "true");
+shouldBe("i2.getAttribute('formNoValidate')", "''");
+shouldBe("i2.formNoValidate", "true");
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/incremental-dom-property.html b/LayoutTests/fast/forms/incremental-dom-property.html
index 89735ef..56eff86 100644
--- a/LayoutTests/fast/forms/incremental-dom-property.html
+++ b/LayoutTests/fast/forms/incremental-dom-property.html
@@ -6,7 +6,23 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/incremental-dom-property.js"></script>
+<script>
+description('Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=50335">https://bugs.webkit.org/show_bug.cgi?id=50335</a>');
+
+var input = document.createElement('input');
+
+input.setAttribute('incremental', '')
+shouldBeTrue('input.incremental');
+
+input.removeAttribute('incremental');
+shouldBeFalse('input.incremental');
+
+input.incremental = true;
+shouldBeTrue('input.hasAttribute("incremental")');
+
+input.incremental = false;
+shouldBeFalse('input.hasAttribute("incremental")');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-maxlength-ime-completed.html b/LayoutTests/fast/forms/input-maxlength-ime-completed.html
index 3378d1e..cceff3a 100644
--- a/LayoutTests/fast/forms/input-maxlength-ime-completed.html
+++ b/LayoutTests/fast/forms/input-maxlength-ime-completed.html
@@ -6,7 +6,20 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-maxlength-ime-completed.js"></script>
+<script>
+description('There was a bug that users could input text longer than maxlength via IME. This test confirms it was fixed.');
+
+var input = document.createElement('input');
+input.maxLength = 2;
+document.body.appendChild(input);
+input.focus();
+textInputController.setMarkedText('abcd', 0, 4);
+textInputController.insertText('abcd'); // Debug WebKit crashed by this without the change of bug#25253.
+// Check the current value without input.value.
+// In Release WebKit, input.value was 'ab' though the user-visible value was 'abcd'.
+document.execCommand('SelectAll');
+shouldBe('document.getSelection().toString()', '"ab"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-maxlength-ime-preedit.html b/LayoutTests/fast/forms/input-maxlength-ime-preedit.html
index 1d15c0a..e839dac 100644
--- a/LayoutTests/fast/forms/input-maxlength-ime-preedit.html
+++ b/LayoutTests/fast/forms/input-maxlength-ime-preedit.html
@@ -6,7 +6,17 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-maxlength-ime-preedit.js"></script>
+<script>
+description('This test checks users can input pre-edit text longer than maxlength.');
+
+var input = document.createElement('input');
+document.body.appendChild(input);
+input.maxLength = 2;
+input.focus();
+textInputController.setMarkedText('abcd', 0, 4);
+// The selection should have 4 characters though maxLength is 2.
+shouldBe('document.getSelection().toString()', '"abcd"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-maxlength-unsupported.html b/LayoutTests/fast/forms/input-maxlength-unsupported.html
index 082b22fe..33f0ce1 100644
--- a/LayoutTests/fast/forms/input-maxlength-unsupported.html
+++ b/LayoutTests/fast/forms/input-maxlength-unsupported.html
@@ -6,7 +6,19 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-maxlength-unsupported.js"></script>
+<script>
+description('A test for maxlength attribute of an input element with non-text type');
+
+var input = document.createElement('input');
+input.maxLength = 2;
+input.type = 'number';
+document.body.appendChild(input);
+input.focus();
+document.execCommand('insertText', false, '1234');
+shouldBe('input.value', '"1234"');
+
+input.parentNode.removeChild(input);
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-minmax.html b/LayoutTests/fast/forms/input-minmax.html
index 806787a..f32c446 100644
--- a/LayoutTests/fast/forms/input-minmax.html
+++ b/LayoutTests/fast/forms/input-minmax.html
@@ -6,7 +6,87 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-minmax.js"></script>
+<script>
+description('Tests the behavior of .min and .max of HTMLInputElement.');
+
+var input = document.createElement('input');
+
+// .min and .max just reflect the corresponding attributes.
+input.type = 'text';
+shouldBe('input.min', '""');
+shouldBe('input.max', '""');
+input.setAttribute('min', '0');
+input.setAttribute('max', '100');
+shouldBe('input.min', '"0"');
+shouldBe('input.max', '"100"');
+input.setAttribute('min', 'abc');
+input.setAttribute('max', 'qwerty');
+shouldBe('input.min', '"abc"');
+shouldBe('input.max', '"qwerty"');
+
+input.min = 'foo';
+input.max = 'bar';
+shouldBe('input.getAttribute("min")', '"foo"');
+shouldBe('input.getAttribute("max")', '"bar"');
+input.min = '';
+input.max = '';
+shouldBe('input.getAttribute("min")', '""');
+shouldBe('input.getAttribute("max")', '""');
+
+// Null.
+debug('Setting null to min:');
+input.min = null;
+shouldBe('input.min', '""');
+shouldBe('input.getAttribute("min")', 'null');
+input.setAttribute('min', null);
+shouldBe('input.min', '"null"');
+
+debug('Setting null to max:');
+input.max = null;
+shouldBe('input.max', '""');
+shouldBe('input.getAttribute("max")', 'null');
+input.setAttribute('max', null);
+shouldBe('input.max', '"null"');
+
+// Undefined.
+debug('Setting undefined to min:');
+input.min = undefined;
+shouldBe('input.min', '"undefined"');
+shouldBe('input.getAttribute("min")', '"undefined"');
+input.setAttribute('min', undefined);
+shouldBe('input.min', '"undefined"');
+
+debug('Setting undefined to max:');
+input.max = undefined;
+shouldBe('input.max', '"undefined"');
+shouldBe('input.getAttribute("max")', '"undefined"');
+input.setAttribute('max', undefined);
+shouldBe('input.max', '"undefined"');
+
+// Non-string.
+debug('Setting non-string to min:');
+input.min = 256;
+shouldBe('input.min', '"256"');
+shouldBe('input.getAttribute("min")', '"256"');
+input.setAttribute('min', 256);
+shouldBe('input.min', '"256"');
+
+debug('Setting non-string to max:');
+input.max = 256;
+shouldBe('input.max', '"256"');
+shouldBe('input.getAttribute("max")', '"256"');
+input.setAttribute('max', 256);
+shouldBe('input.max', '"256"');
+
+// The range type has the default minimum and the default maximum.
+// But they aren't exposed by .min .max IDL attributes.
+debug('Check implicit min/max of type=range:');
+input.type = 'range';
+input.setAttribute('min', '');
+input.setAttribute('max', '');
+shouldBe('input.min', '""');
+shouldBe('input.max', '""');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-pattern.html b/LayoutTests/fast/forms/input-pattern.html
index 608741b..9417aa9 100644
--- a/LayoutTests/fast/forms/input-pattern.html
+++ b/LayoutTests/fast/forms/input-pattern.html
@@ -6,7 +6,42 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-pattern.js"></script>
+<script>
+description('Test the behavior of pattern attribute and pattern DOM property.');
+
+var input = document.createElement('input');
+input.type = 'text';
+
+// No pattern attribute.
+shouldBe('input.pattern', '""');
+
+// Set a string value.
+input.pattern = 'foo';
+shouldBe('input.getAttribute("pattern")', '"foo"');
+input.setAttribute('pattern', 'bar');
+shouldBe('input.pattern', '"bar"');
+
+// Null.
+input.pattern = null;
+shouldBe('input.pattern', '""');
+shouldBe('input.getAttribute("pattern")', 'null');
+input.setAttribute('pattern', null);
+shouldBe('input.pattern', '"null"');
+
+// Undefined.
+input.pattern = undefined;
+shouldBe('input.pattern', '"undefined"');
+shouldBe('input.getAttribute("pattern")', '"undefined"');
+input.setAttribute('pattern', undefined);
+shouldBe('input.pattern', '"undefined"');
+
+// Non-string.
+input.pattern = 256;
+shouldBe('input.pattern', '"256"');
+shouldBe('input.getAttribute("pattern")', '"256"');
+input.setAttribute('pattern', 256);
+shouldBe('input.pattern', '"256"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-step.html b/LayoutTests/fast/forms/input-step.html
index bef8a38..8924089 100644
--- a/LayoutTests/fast/forms/input-step.html
+++ b/LayoutTests/fast/forms/input-step.html
@@ -6,7 +6,42 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-step.js"></script>
+<script>
+description('Test the behavior of step attribute and step DOM property.');
+
+var input = document.createElement('input');
+input.type = 'number';
+
+// No step attribute.
+shouldBe('input.step', '""');
+
+// Set an invalid step value.
+input.step = 'foo';
+shouldBe('input.getAttribute("step")', '"foo"');
+input.setAttribute('step', 'bar');
+shouldBe('input.step', '"bar"');
+
+// Null.
+input.step = null;
+shouldBe('input.step', '""');
+shouldBe('input.getAttribute("step")', 'null');
+input.setAttribute('step', null);
+shouldBe('input.step', '"null"');
+
+// Undefined.
+input.step = undefined;
+shouldBe('input.step', '"undefined"');
+shouldBe('input.getAttribute("step")', '"undefined"');
+input.setAttribute('step', undefined);
+shouldBe('input.step', '"undefined"');
+
+// Non-string.
+input.step = 256;
+shouldBe('input.step', '"256"');
+shouldBe('input.getAttribute("step")', '"256"');
+input.setAttribute('step', 256);
+shouldBe('input.step', '"256"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-stepup-stepdown.html b/LayoutTests/fast/forms/input-stepup-stepdown.html
index e50b106..ec750f3 100644
--- a/LayoutTests/fast/forms/input-stepup-stepdown.html
+++ b/LayoutTests/fast/forms/input-stepup-stepdown.html
@@ -6,7 +6,19 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-stepup-stepdown.js"></script>
+<script>
+description('Check stepUp() and stepDown() bahevior for unsupported types.');
+
+var input = document.createElement('input');
+var invalidStateErr = '"Error: INVALID_STATE_ERR: DOM Exception 11"';
+
+debug('Unsupported type');
+input.type = 'text';
+shouldThrow('input.step = "3"; input.min = ""; input.max = ""; input.value = "2"; input.stepDown()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
+shouldThrow('input.stepDown(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
+shouldThrow('input.stepUp()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
+shouldThrow('input.stepUp(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-type-change3.html b/LayoutTests/fast/forms/input-type-change3.html
index 5518660..5922eb4 100644
--- a/LayoutTests/fast/forms/input-type-change3.html
+++ b/LayoutTests/fast/forms/input-type-change3.html
@@ -6,7 +6,55 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-type-change3.js"></script>
+<script>
+description('Tests for writing and reading .type property of HTMLInputElement.');
+
+var input = document.createElement('input');
+document.body.appendChild(input);
+
+// The default type is "text".
+shouldBe('input.type', '"text"');
+
+function check(value, expected)
+{
+ input.type = value;
+ if (input.type == expected)
+ testPassed('input.type for "' + value + '" is correctly "' + input.type + '".');
+ else
+ testFailed('input.type for "' + value + '" is incorrectly "' + input.type + '", should be "' + expected + '".');
+}
+
+// The type is not specified explicitly. We can change it to "file".
+check("file", "file");
+// http://webkit.org/b/57343
+check("file", "file");
+check("FILE", "file");
+
+check("text", "text");
+check("TEXT", "text"); // input.type must return a lower case value according to DOM Level 2.
+check(" text ", "text");
+check("button", "button");
+check(" button ", "text");
+check("checkbox", "checkbox");
+check("email", "email");
+check("file", "email"); // We can't change a concrete type to file for a security reason.
+check("hidden", "hidden");
+check("image", "image");
+check("isindex", "text");
+check("number", "number");
+check("password", "password");
+check("passwd", "text");
+check("radio", "radio");
+check("range", "range");
+check("reset", "reset");
+check("search", "search");
+check("submit", "submit");
+check("tel", "tel");
+check("telephone", "text");
+check("url", "url");
+check("uri", "text");
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/input-valueasnumber-unsupported.html b/LayoutTests/fast/forms/input-valueasnumber-unsupported.html
index 5feff12..3b3cd19 100644
--- a/LayoutTests/fast/forms/input-valueasnumber-unsupported.html
+++ b/LayoutTests/fast/forms/input-valueasnumber-unsupported.html
@@ -6,7 +6,38 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/input-valueasnumber-unsupported.js"></script>
+<script>
+description('Tests for .valueAsNumber with non-supported input types.');
+
+var input = document.createElement('input');
+input.type = 'range';
+document.body.appendChild(input);
+
+function checkValueAsNumber(type) {
+ debug('Check for type=' + type);
+ input.value = '0';
+ input.type = type;
+ shouldBe('input.valueAsNumber', 'Number.NaN');
+ shouldThrow('input.valueAsNumber = 0', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
+}
+
+checkValueAsNumber('button');
+checkValueAsNumber('checkbox');
+checkValueAsNumber('color');
+checkValueAsNumber('email');
+checkValueAsNumber('file');
+checkValueAsNumber('hidden');
+checkValueAsNumber('image');
+checkValueAsNumber('khtml_isindex');
+checkValueAsNumber('password');
+checkValueAsNumber('radio');
+checkValueAsNumber('reset');
+checkValueAsNumber('search');
+checkValueAsNumber('submit');
+checkValueAsNumber('tel');
+checkValueAsNumber('text');
+checkValueAsNumber('url');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-add-htmlFor-label.html b/LayoutTests/fast/forms/labels-add-htmlFor-label.html
index 955d0f8..3e1d380 100644
--- a/LayoutTests/fast/forms/labels-add-htmlFor-label.html
+++ b/LayoutTests/fast/forms/labels-add-htmlFor-label.html
@@ -6,7 +6,43 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-add-htmlFor-label.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when adding a label whose htmlFor points to that control. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"><button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
+
+document.body.appendChild(parent);
+
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+label.htmlFor = "id1";
+document.getElementById("div1").appendChild(label);
+shouldBe('labels.length', '1');
+
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+label.htmlFor = "id2";
+document.getElementById("div1").appendChild(label);
+shouldBe('labels.length', '1');
+
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+label.htmlFor = "id3";
+document.getElementById("div1").appendChild(label);
+shouldBe('labels.length', '1');
+
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+label.htmlFor = "id4";
+document.getElementById("div1").appendChild(label);
+shouldBe('labels.length', '1');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-add-parent-label.html b/LayoutTests/fast/forms/labels-add-parent-label.html
index 6c9c8a4..92624ec 100644
--- a/LayoutTests/fast/forms/labels-add-parent-label.html
+++ b/LayoutTests/fast/forms/labels-add-parent-label.html
@@ -6,7 +6,44 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-add-parent-label.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when adding a label as parent for that form control. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
+
+document.body.appendChild(parent);
+
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+document.getElementById("div1").appendChild(label);
+label.appendChild(document.getElementById("id1"));
+shouldBe('labels.length', '1');
+
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+document.getElementById("div1").appendChild(label);
+label.appendChild(document.getElementById("id2"));
+shouldBe('labels.length', '1');
+
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+document.getElementById("div1").appendChild(label);
+label.appendChild(document.getElementById("id3"));
+shouldBe('labels.length', '1');
+
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '0');
+label = document.createElement("label");
+document.getElementById("div1").appendChild(label);
+label.appendChild(document.getElementById("id4"));
+shouldBe('labels.length', '1');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-change-htmlFor-attribute.html b/LayoutTests/fast/forms/labels-change-htmlFor-attribute.html
index b1a9896..163cea0 100644
--- a/LayoutTests/fast/forms/labels-change-htmlFor-attribute.html
+++ b/LayoutTests/fast/forms/labels-change-htmlFor-attribute.html
@@ -6,7 +6,40 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-change-htmlFor-attribute.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label changes to point to that control. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><label id="labelId"></label><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
+
+document.body.appendChild(parent);
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '0');
+label.htmlFor = "id1";
+shouldBe('labels.length', '1');
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '0');
+label.htmlFor = "id2";
+shouldBe('labels.length', '1');
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '0');
+label.htmlFor = "id3";
+shouldBe('labels.length', '1');
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '0');
+label.htmlFor = "id4";
+shouldBe('labels.length', '1');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-item-index.html b/LayoutTests/fast/forms/labels-item-index.html
index 229985d..6d69204 100644
--- a/LayoutTests/fast/forms/labels-item-index.html
+++ b/LayoutTests/fast/forms/labels-item-index.html
@@ -6,7 +6,27 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-item-index.js"></script>
+<script>
+description('Test that the items of a labels list can be accessed individually. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div><label id="l1" for="id1"></label><label id="l2" for="id2"></label><label id="l3" for="id3"></label><label id="l4" for="id4"></label><label id="l11" for="id1"></label><label id="l12" for="id2"></label><label id="l13" for="id3"></label><label id="l14" for="id4"></label>';
+
+document.body.appendChild(parent);
+
+labels = document.getElementById("id1").labels;
+shouldBe('labels.item(1).id', '"l11"');
+
+labels = document.getElementById("id2").labels;
+shouldBe('labels.item(1).id', '"l12"');
+
+labels = document.getElementById("id3").labels;
+shouldBe('labels.item(1).id', '"l13"');
+
+labels = document.getElementById("id4").labels;
+shouldBe('labels.item(1).id', '"l14"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-remove-htmlFor-attribute.html b/LayoutTests/fast/forms/labels-remove-htmlFor-attribute.html
index c0ab0cc..300a8e5 100644
--- a/LayoutTests/fast/forms/labels-remove-htmlFor-attribute.html
+++ b/LayoutTests/fast/forms/labels-remove-htmlFor-attribute.html
@@ -6,7 +6,40 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-remove-htmlFor-attribute.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label is removed.');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><label id="label1" for="id1"></label><label id="label2" for="id2"></label><label id="label3" for="id3"></label><label id="label4" for="id4"></label><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
+
+document.body.appendChild(parent);
+
+label = document.getElementById("label1");
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '1');
+label.removeAttribute("for");
+shouldBe('labels.length', '0');
+
+label = document.getElementById("label2");
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '1');
+label.removeAttribute("for");
+shouldBe('labels.length', '0');
+
+label = document.getElementById("label3");
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '1');
+label.removeAttribute("for");
+shouldBe('labels.length', '0');
+
+label = document.getElementById("label4");
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '1');
+label.removeAttribute("for");
+shouldBe('labels.length', '0');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-remove-htmlFor-label.html b/LayoutTests/fast/forms/labels-remove-htmlFor-label.html
index 30f7064..62dc2dc 100644
--- a/LayoutTests/fast/forms/labels-remove-htmlFor-label.html
+++ b/LayoutTests/fast/forms/labels-remove-htmlFor-label.html
@@ -6,7 +6,35 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-remove-htmlFor-label.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when removing the htmlFor attribute that pointed to that form control.');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div><label id="l1" for="id1"></label><label id="l2" for="id2"></label><label id="l3" for="id3"></label><label id="l4" for="id4"></label>';
+
+document.body.appendChild(parent);
+
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '1');
+document.getElementById("l1").htmlFor = "";
+shouldBe('labels.length', '0');
+
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '1');
+document.getElementById("l2").htmlFor = "";
+shouldBe('labels.length', '0');
+
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '1');
+document.getElementById("l3").htmlFor = "";
+shouldBe('labels.length', '0');
+
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '1');
+document.getElementById("l4").htmlFor = "";
+shouldBe('labels.length', '0');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-remove-parent-label.html b/LayoutTests/fast/forms/labels-remove-parent-label.html
index 88dd0a1..61abe5f 100644
--- a/LayoutTests/fast/forms/labels-remove-parent-label.html
+++ b/LayoutTests/fast/forms/labels-remove-parent-label.html
@@ -6,7 +6,36 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-remove-parent-label.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when removing a label as parent for that form control. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><label><button id="id1"></button></label><label><input id="id2"></label><label><select id="id3"></select></label><label><textarea id="id4"></textarea></label></div>';
+
+
+document.body.appendChild(parent);
+
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '1');
+document.getElementById("div1").appendChild(document.getElementById("id1"));
+shouldBe('labels.length', '0');
+
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '1');
+document.getElementById("div1").appendChild(document.getElementById("id2"));
+shouldBe('labels.length', '0');
+
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '1');
+document.getElementById("div1").appendChild(document.getElementById("id3"));
+shouldBe('labels.length', '0');
+
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '1');
+document.getElementById("div1").appendChild(document.getElementById("id4"));
+shouldBe('labels.length', '0');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/labels-set-htmlFor-attribute.html b/LayoutTests/fast/forms/labels-set-htmlFor-attribute.html
index 2cb4a36..e229d591 100644
--- a/LayoutTests/fast/forms/labels-set-htmlFor-attribute.html
+++ b/LayoutTests/fast/forms/labels-set-htmlFor-attribute.html
@@ -6,7 +6,40 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/labels-set-htmlFor-attribute.js"></script>
+<script>
+description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label changes to point to that control. ');
+
+var parent = document.createElement('div');
+
+parent.innerHTML = '<div id="div1"></div><div id="div2"><label id="labelId"></label><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
+
+document.body.appendChild(parent);
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id1").labels;
+shouldBe('labels.length', '0');
+label.setAttribute("for", "id1");
+shouldBe('labels.length', '1');
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id2").labels;
+shouldBe('labels.length', '0');
+label.setAttribute("for", "id2");
+shouldBe('labels.length', '1');
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id3").labels;
+shouldBe('labels.length', '0');
+label.setAttribute("for", "id3");
+shouldBe('labels.length', '1');
+
+label = document.getElementById("labelId");
+labels = document.getElementById("id4").labels;
+shouldBe('labels.length', '0');
+label.setAttribute("for", "id4");
+shouldBe('labels.length', '1');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/listbox-deselect-scroll.html b/LayoutTests/fast/forms/listbox-deselect-scroll.html
index c64ed91c..1548d7a 100644
--- a/LayoutTests/fast/forms/listbox-deselect-scroll.html
+++ b/LayoutTests/fast/forms/listbox-deselect-scroll.html
@@ -6,7 +6,53 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/listbox-deselect-scroll.js"></script>
+<script>
+description('This tests that deselecting an option won't cause unnecessary scrolling.');
+
+function mouseDownOnSelect(selId, index, modifier) {
+ var sl = document.getElementById(selId);
+ var itemHeight = Math.floor(sl.offsetHeight / sl.size);
+ var border = 1;
+ var y = border + index * itemHeight - window.pageYOffset;
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(sl.offsetLeft + border, sl.offsetTop + y);
+ eventSender.mouseDown(0, [modifier]);
+ eventSender.mouseUp(0, [modifier]);
+ }
+}
+
+function selectionPattern(select) {
+ var result = '';
+ for (var i = 0; i < select.options.length; i++)
+ result += select.options[i].selected ? '1' : '0';
+ return result;
+}
+
+var parent = document.createElement('div');
+parent.innerHTML = '<select id="sl" multiple="multiple" size="5">'
+ + '<option value="Accessibility">Accessibility</option>'
+ + '<option value="CSS">CSS</option>'
+ + '<option value="Drosera">Drosera</option>'
+ + '<option value="Evangelism">Evangelism</option>'
+ + '<option value="Forms">Forms</option>'
+ + '<option value="Frames">Frames</option>'
+ + '<option value="History">History</option>'
+ + '<option value="HTML DOM">HTML DOM</option>'
+ + '<option value="HTML Editing">HTML Editing</option>'
+ + '<option value="Images">Images</option>'
+ + '<option>SCROLL UP</option>'
+ + '</select>';
+document.body.appendChild(parent);
+
+var sl = document.getElementById('sl');
+sl.focus();
+document.execCommand("SelectAll");
+sl.scrollTop = Math.floor(sl.offsetHeight / sl.size) * 4 + 6;
+var scrollBeforeClick = sl.scrollTop;
+mouseDownOnSelect("sl", 3, "addSelectionKey");
+shouldBe('sl.scrollTop', 'scrollBeforeClick');
+shouldBe('selectionPattern(sl)', '"11111110111"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/listbox-selection-2.html b/LayoutTests/fast/forms/listbox-selection-2.html
index 3421ec3..1ea7abb 100644
--- a/LayoutTests/fast/forms/listbox-selection-2.html
+++ b/LayoutTests/fast/forms/listbox-selection-2.html
@@ -6,7 +6,95 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/listbox-selection-2.js"></script>
+<script>
+description('<select> selection test for scrolling.');
+
+var parent = document.createElement('div');
+parent.innerHTML = '<select id="sl1" multiple size=5>'
+ + '<option>one</option>'
+ + '<option>two</option>'
+ + '<option>three</option>'
+ + '<option>four</option>'
+ + '<option>five</option>'
+ + '<option>six</option>'
+ + '<option>seven</option>'
+ + '<option>eight</option>'
+ + '<option>nine</option>'
+ + '<option>ten</option>'
+ + '<option>eleven</option>'
+ + '<option>twelve</option>'
+ + '<option>thirteen</option>'
+ + '<option>fourteen</option>'
+ + '<option>fifteen</option>'
+ + '<option>sixteen</option>'
+ + '<option>seventeen</option>'
+ + '</select>'
+ + '<select id="sl2" multiple style="height: 135px; border: 10px solid; padding: 5px;">'
+ + '<option>one</option>'
+ + '<option>two</option>'
+ + '<option>three</option>'
+ + '</select>';
+document.body.appendChild(parent);
+
+// Determine the item height.
+var sl1 = document.getElementById('sl1');
+var sl2 = document.getElementById('sl2');
+var itemHeight = Math.floor(sl1.offsetHeight / sl1.size);
+sl1.removeAttribute('size');
+var height = itemHeight * 9 + 9;
+sl1.setAttribute('style', 'height: ' + height + 'px; border: 10px solid; padding: 5px;');
+
+function mouseDownOnSelect(selId, index)
+{
+ var sl = document.getElementById(selId);
+ var borderPaddingTop = 15;
+ var borderPaddingLeft = 15;
+ var y = index * itemHeight + itemHeight / 3 - window.pageYOffset + borderPaddingTop;
+ var event = document.createEvent("MouseEvent");
+ event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y, sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y, false, false, false, false, 0, document);
+ sl.dispatchEvent(event);
+}
+
+function selectionPattern(selectId)
+{
+ var select = document.getElementById(selectId);
+ var result = "";
+ for (var i = 0; i < select.options.length; i++)
+ result += select.options[i].selected ? '1' : '0';
+ return result;
+}
+
+mouseDownOnSelect("sl1", 0);
+shouldBe('selectionPattern("sl1")', '"10000000000000000"');
+
+mouseDownOnSelect("sl1", 1);
+shouldBe('selectionPattern("sl1")', '"01000000000000000"');
+
+mouseDownOnSelect("sl1", 6);
+shouldBe('selectionPattern("sl1")', '"00000010000000000"');
+
+mouseDownOnSelect("sl1", 7);
+shouldBe('selectionPattern("sl1")', '"00000001000000000"');
+
+mouseDownOnSelect("sl1", 8);
+shouldBe('selectionPattern("sl1")', '"00000001000000000"');
+
+mouseDownOnSelect("sl1", 0);
+shouldBe('selectionPattern("sl1")', '"01000000000000000"');
+
+for (i = 0; i < 9; i++)
+ mouseDownOnSelect("sl1", 7);
+shouldBe('selectionPattern("sl1")', '"00000000000000001"');
+
+mouseDownOnSelect("sl2", 1);
+shouldBe('selectionPattern("sl2")', '"010"');
+
+mouseDownOnSelect("sl2", 3);
+shouldBe('selectionPattern("sl2")', '"010"');
+
+mouseDownOnSelect("sl2", 2);
+shouldBe('selectionPattern("sl2")', '"001"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/listbox-selection.html b/LayoutTests/fast/forms/listbox-selection.html
index 94c026c..28594eb 100644
--- a/LayoutTests/fast/forms/listbox-selection.html
+++ b/LayoutTests/fast/forms/listbox-selection.html
@@ -6,7 +6,133 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/listbox-selection.js"></script>
+<script>
+description('<select> selection test for mouse events and keyevents.');
+
+function mouseDownOnSelect(selId, index, modifier) {
+ var sl = document.getElementById(selId);
+ var itemHeight = Math.floor(sl.offsetHeight / sl.size);
+ var border = 1;
+ var y = border + index * itemHeight;
+
+ sl.focus();
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(sl.offsetLeft + border, sl.offsetTop + y - window.pageYOffset);
+ eventSender.mouseDown(0, [modifier]);
+ eventSender.mouseUp(0, [modifier]);
+ }
+}
+
+function keyDownOnSelect(selId, identifier, modifier) {
+ document.getElementById(selId).focus();
+ if (window.eventSender)
+ eventSender.keyDown(identifier, [modifier]);
+}
+
+function createSelect(idName, sz, mlt, selIndex) {
+ var sl = document.createElement("select");
+ var i = 0;
+ sl.size = sz;
+ while (i < sz) {
+ var opt = document.createElement("option");
+ if (i == selIndex)
+ opt.selected = true;
+ opt.textContent = "item " + i;
+ sl.appendChild(opt);
+ i++;
+ }
+ sl.multiple = mlt;
+ sl.id = idName;
+ var parent = document.getElementById("parent");
+ parent.appendChild(sl);
+}
+
+function selectionPattern(selId) {
+ var sl = document.getElementById(selId);
+ var result = '';
+ for (var i = 0; i < sl.options.length; i++)
+ result += sl.options[i].selected ? '1' : '0';
+ return result;
+}
+
+var parent = document.createElement('div');
+parent.id = "parent";
+document.body.appendChild(parent);
+
+createSelect("sl1", 5, false, -1);
+createSelect("sl2", 5, false, 1);
+createSelect("sl3", 5, false, -1);
+createSelect("sl4", 5, false, 1);
+createSelect("sl5", 5, false, 2);
+createSelect("sl6", 5, false, 3);
+createSelect("sl7", 5, false, 1);
+
+createSelect("sl8", 5, true, -1);
+createSelect("sl9", 5, true, 1);
+createSelect("sl10", 5, true, -1);
+createSelect("sl11", 5, true, 1);
+createSelect("sl12", 5, true, 2);
+createSelect("sl13", 5, true, 0);
+createSelect("sl14", 5, true, 1);
+
+debug("1) Select one item with mouse (no previous selection)");
+mouseDownOnSelect("sl1", 0);
+shouldBe('selectionPattern("sl1")', '"10000"');
+
+debug("2) Select one item with mouse (with previous selection)");
+mouseDownOnSelect("sl2", 0);
+shouldBe('selectionPattern("sl2")', '"10000"');
+
+debug("3) Select one item with the keyboard (no previous selection)");
+keyDownOnSelect("sl3", "upArrow");
+shouldBe('selectionPattern("sl3")', '"00001"');
+
+debug("4) Select one item with the keyboard (with previous selection)");
+keyDownOnSelect("sl4", "downArrow");
+shouldBe('selectionPattern("sl4")', '"00100"');
+
+debug("5) Attempt to select an item cmd-clicking");
+mouseDownOnSelect("sl5", 1, "addSelectionKey");
+shouldBe('selectionPattern("sl5")', '"01000"');
+
+debug("6) Attempt to select a range shift-clicking");
+mouseDownOnSelect("sl6", 1, "rangeSelectionKey");
+shouldBe('selectionPattern("sl6")', '"01000"');
+
+debug("7) Attempt to select a range with the keyboard");
+keyDownOnSelect("sl7", "downArrow", "rangeSelectionKey");
+shouldBe('selectionPattern("sl7")', '"00100"');
+
+// Multiple selection tests
+
+debug("8) Select one item with mouse (no previous selection)");
+mouseDownOnSelect("sl8", 0);
+shouldBe('selectionPattern("sl8")', '"10000"');
+
+debug("9) Select one item with mouse (with previous selection)");
+mouseDownOnSelect("sl9", 0);
+shouldBe('selectionPattern("sl9")', '"10000"');
+
+debug("10) Select one item with the keyboard (no previous selection)");
+keyDownOnSelect("sl10", "upArrow");
+shouldBe('selectionPattern("sl10")', '"00001"');
+
+debug("11) Select one item with the keyboard (with previous selection)");
+keyDownOnSelect("sl11", "downArrow");
+shouldBe('selectionPattern("sl11")', '"00100"');
+
+debug("12) Select an item cmd-clicking");
+mouseDownOnSelect("sl12", 1, "addSelectionKey");
+shouldBe('selectionPattern("sl12")', '"01100"');
+
+debug("13) Select a range shift-clicking");
+mouseDownOnSelect("sl13", 3, "rangeSelectionKey");
+shouldBe('selectionPattern("sl13")', '"11110"');
+
+debug("14) Select a range with the keyboard");
+keyDownOnSelect("sl14", "downArrow", "rangeSelectionKey");
+shouldBe('selectionPattern("sl14")', '"01100"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/menulist-disabled-selected-option.html b/LayoutTests/fast/forms/menulist-disabled-selected-option.html
index 52d919b..65b4c05 100644
--- a/LayoutTests/fast/forms/menulist-disabled-selected-option.html
+++ b/LayoutTests/fast/forms/menulist-disabled-selected-option.html
@@ -6,7 +6,33 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/menulist-disabled-selected-option.js"></script>
+<script>
+description('Check that a select control does not produce a form value if the selected option element is disabled.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<form action="">'
+ + '<input type=hidden name="submitted" value="true">'
+ + '<select name="select">'
+ + '<option disabled>Disabled</option>'
+ + '<option>Enabled</option>'
+ + '</select>'
+ + '</form>';
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+var query = window.location.search;
+if (query.indexOf('submitted=true') == -1) {
+ var select = document.getElementsByTagName('select')[0];
+ select.selectedIndex = 0;
+ document.forms[0].submit();
+} else {
+ shouldBe('query.indexOf("select=Disabled")', '-1');
+ shouldBe('query.indexOf("select=Enabled")', '-1');
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/menulist-submit-without-selection.html b/LayoutTests/fast/forms/menulist-submit-without-selection.html
index 5f3b107..79b3431 100644
--- a/LayoutTests/fast/forms/menulist-submit-without-selection.html
+++ b/LayoutTests/fast/forms/menulist-submit-without-selection.html
@@ -6,7 +6,31 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/menulist-submit-without-selection.js"></script>
+<script>
+description('A unselected option was submitted as fallback. This behavior was removed by the change of webkit.org/b/35056.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<form action="">'
+ + '<input type=hidden name="submitted" value="true">'
+ + '<select name="select">'
+ + '<option disabled>Disabled</option>'
+ + '</select>'
+ + '</form>';
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+var query = window.location.search;
+if (query.indexOf('submitted=true') == -1) {
+ var select = document.getElementsByTagName('select')[0];
+ select.selectedIndex = 0;
+ document.forms[0].submit();
+} else {
+ shouldBe('query.indexOf("select=Disabled")', '-1');
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/novalidate-attribute.html b/LayoutTests/fast/forms/novalidate-attribute.html
index 6d27dda..0475d4a 100644
--- a/LayoutTests/fast/forms/novalidate-attribute.html
+++ b/LayoutTests/fast/forms/novalidate-attribute.html
@@ -6,7 +6,42 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/novalidate-attribute.js"></script>
+<script>
+description("This test performs some simple check on the noValidate attribute.");
+
+var f = document.createElement("form");
+
+shouldBe("f.hasAttribute('noValidate')", "false");
+shouldBe("f.getAttribute('noValidate')", "null");
+shouldBe("f.noValidate", "false");
+
+f.noValidate = true;
+
+shouldBe("f.hasAttribute('noValidate')", "true");
+shouldBe("f.getAttribute('noValidate')", "''");
+shouldBe("f.noValidate", "true");
+
+var f2 = document.createElement("form");
+f2.noValidate = f.noValidate;
+
+f.noValidate = false;
+
+shouldBe("f.hasAttribute('noValidate')", "false");
+shouldBe("f.getAttribute('noValidate')", "null");
+shouldBe("f.noValidate", "false");
+
+shouldBe("f2.hasAttribute('noValidate')", "true");
+shouldBe("f2.getAttribute('noValidate')", "''");
+shouldBe("f2.noValidate", "true");
+
+f2.noValidate = false;
+
+shouldBe("f2.noValidate", "false");
+f2.noValidate = "something";
+shouldBe("f2.hasAttribute('noValidate')", "true");
+shouldBe("f2.getAttribute('noValidate')", "''");
+shouldBe("f2.noValidate", "true");
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/output-reset-assertion-failed.html b/LayoutTests/fast/forms/output-reset-assertion-failed.html
index b2b6aa8..c41fb51 100644
--- a/LayoutTests/fast/forms/output-reset-assertion-failed.html
+++ b/LayoutTests/fast/forms/output-reset-assertion-failed.html
@@ -6,7 +6,50 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/output-reset-assertion-failed.js"></script>
+<script>
+description('Ensures that assertion failures don\'t occur on updating the value of <output> elements.');
+
+debug('- A test in the value is set twice.');
+var output = document.createElement('output');
+document.body.appendChild(output);
+output.value = '';
+output.value = '';
+testPassed('Not crashed');
+document.body.removeChild(output);
+
+debug('');
+debug('- A test in the value is set to different values twice.');
+output = document.createElement('output');
+document.body.appendChild(output);
+output.value = '';
+output.value = 'foo';
+testPassed('Not crashed');
+document.body.removeChild(output);
+
+debug('');
+debug('- A test in reset events occur twice when there is no default value.');
+var form = document.createElement('form');
+document.body.appendChild(form);
+output = document.createElement('output');
+form.appendChild(output);
+form.reset();
+form.reset();
+testPassed('Not crashed');
+document.body.removeChild(form);
+
+debug('');
+debug('- A test in reset events occur twice when the value is the same as the default value.');
+form = document.createElement('form');
+document.body.appendChild(form);
+output = document.createElement('output');
+output.defaultValue = 'foo';
+output.value = 'foo';
+form.appendChild(output);
+form.reset();
+form.reset();
+testPassed('Not crashed');
+document.body.removeChild(form);
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/placeholder-dom-property.html b/LayoutTests/fast/forms/placeholder-dom-property.html
index 30fb2a9..3843af9 100644
--- a/LayoutTests/fast/forms/placeholder-dom-property.html
+++ b/LayoutTests/fast/forms/placeholder-dom-property.html
@@ -6,7 +6,20 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/placeholder-dom-property.js"></script>
+<script>
+description("Test for <a href='https://bugs.webkit.org/show_bug.cgi?id=21903'>https://bugs.webkit.org/show_bug.cgi?id=21903</a>");
+
+var input = document.createElement("input");
+
+shouldBeEqualToString("input.placeholder", '');
+
+input.setAttribute("placeholder", "p1")
+shouldBeEqualToString("input.placeholder", 'p1');
+
+input.placeholder = 'p2';
+shouldBeEqualToString("input.getAttribute('placeholder')", 'p2');
+shouldBeEqualToString("input.placeholder", 'p2');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/script-tests/TEMPLATE.html b/LayoutTests/fast/forms/script-tests/TEMPLATE.html
deleted file mode 100644
index e439eb3..0000000
--- a/LayoutTests/fast/forms/script-tests/TEMPLATE.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../fast/js/resources/js-test-pre.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script src="YOUR_JS_FILE_HERE"></script>
-<script src="../../fast/js/resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-patternMismatch-unsupported.js b/LayoutTests/fast/forms/script-tests/ValidityState-patternMismatch-unsupported.js
deleted file mode 100644
index 39bd8e34..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-patternMismatch-unsupported.js
+++ /dev/null
@@ -1,14 +0,0 @@
-description('Check if the pattern constraint is not applied to some input types.');
-
-var input = document.createElement('input');
-input.type = 'range';
-input.pattern = '[0-9]'; // Restrict to single digit
-input.value = '11';
-
-// pattern doesn't work for type=range
-shouldBe('input.validity.patternMismatch', 'false');
-
-// works for type=text.
-input.type = 'text';
-shouldBe('input.validity.patternMismatch', 'true');
-
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js b/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js
deleted file mode 100644
index e3f43e4..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js
+++ /dev/null
@@ -1,23 +0,0 @@
-description('This test aims to check for rangeOverflow flag with input fields');
-
-var input = document.createElement('input');
-
-function checkNotOverflow(value, max, disabled)
-{
- input.value = value;
- input.max = max;
- input.disabled = !!disabled;
- var overflow = input.validity.rangeOverflow;
- var resultText = 'The value "' + input.value + '" ' +
- (overflow ? 'overflows' : 'doesn\'t overflow') +
- ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
- if (overflow)
- testFailed(resultText);
- else
- testPassed(resultText);
-}
-
-// ----------------------------------------------------------------
-debug('Type=text');
-input.type = 'text'; // No overflow for type=text.
-checkNotOverflow('101', '100');
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js b/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js
deleted file mode 100644
index 5fc5f92..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js
+++ /dev/null
@@ -1,23 +0,0 @@
-description('This test aims to check for rangeUnderflow flag with input fields');
-
-var input = document.createElement('input');
-
-function checkNotUnderflow(value, min, disabled)
-{
- input.value = value;
- input.min = min;
- input.disabled = !!disabled;
- var underflow = input.validity.rangeUnderflow;
- var resultText = 'The value "' + input.value + '" ' +
- (underflow ? 'underflows' : 'doesn\'t underflow') +
- ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
- if (underflow)
- testFailed(resultText);
- else
- testPassed(resultText);
-}
-
-// ----------------------------------------------------------------
-debug('Type=text');
-input.type = 'text'; // No underflow for type=text.
-checkNotUnderflow('99', '100');
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js b/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
deleted file mode 100644
index eb5a14e..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
+++ /dev/null
@@ -1,22 +0,0 @@
-description('Check stepMismatch results for unsupported types.');
-
-var input = document.createElement('input');
-document.body.appendChild(input);
-
-debug('Unsupported types');
-shouldBe('input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "button"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "checkbox"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "color"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "email"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "hidden"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "image"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "khtml_isindex"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "passwd"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "radio"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "reset"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "search"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "submit"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "tel"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "url"; input.validity.stepMismatch', 'false');
-shouldBe('input.type = "file"; input.validity.stepMismatch', 'false');
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js b/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
deleted file mode 100644
index b4c528f..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
+++ /dev/null
@@ -1,68 +0,0 @@
-description('Tests for tooLong flag with <input> elements.');
-
-var input = document.createElement('input');
-document.body.appendChild(input);
-
-debug('No maxlength and no value');
-shouldBeFalse('input.validity.tooLong');
-
-debug('');
-debug('Non-dirty value');
-input.setAttribute('value', 'abcde');
-input.maxLength = 3;
-shouldBe('input.value.length', '5');
-shouldBeFalse('input.validity.tooLong');
-
-input.setAttribute('value', 'abcdef');
-shouldBe('input.value.length', '6');
-shouldBeFalse('input.validity.tooLong');
-
-debug('');
-debug('Dirty value and longer than maxLength');
-input = document.createElement('input');
-document.body.appendChild(input);
-input.setAttribute('value', 'abcde');
-input.maxLength = 3;
-input.focus();
-input.setSelectionRange(5, 5); // Move the cursor at the end.
-document.execCommand('delete');
-shouldBe('input.value.length', '4');
-shouldBeTrue('input.validity.tooLong');
-// Make the value <=maxLength.
-document.execCommand('delete');
-shouldBeFalse('input.validity.tooLong');
-
-debug('');
-debug('Sets a value via DOM property');
-input.maxLength = 3;
-input.value = 'abcde';
-shouldBeFalse('input.validity.tooLong');
-
-debug('');
-debug('Disabled');
-input.disabled = true;
-shouldBeFalse('input.validity.tooLong');
-input.disabled = false;
-
-debug('');
-debug('Grapheme length is not greater than maxLength though character length is greater');
-// fancyX should be treated as 1 grapheme.
-// U+0305 COMBINING OVERLINE
-// U+0332 COMBINING LOW LINE
-var fancyX = "x\u0305\u0332";
-input = document.createElement('input');
-document.body.appendChild(input);
-input.value = fancyX; // 3 characters, 1 grapheme clusters.
-input.maxLength = 1;
-shouldBeFalse('input.validity.tooLong');
-
-debug('');
-debug('Change the type with a too long value');
-input.maxLength = 3;
-input.value = 'abcde';
-input.type = 'search';
-input.focus();
-input.setSelectionRange(5, 5);
-document.execCommand('delete');
-shouldBeTrue('input.validity.tooLong');
-shouldBeFalse('input.type = "number"; input.validity.tooLong');
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js b/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
deleted file mode 100644
index c606ace..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
+++ /dev/null
@@ -1,83 +0,0 @@
-description('Tests for tooLong flag with <textarea> elements.');
-
-var textarea = document.createElement('textarea');
-document.body.appendChild(textarea);
-
-debug('No maxlength and no value');
-shouldBeFalse('textarea.validity.tooLong');
-
-debug('');
-debug('Non-dirty value');
-textarea.defaultValue = 'abcde';
-textarea.maxLength = 3;
-shouldBe('textarea.value.length', '5');
-shouldBeFalse('textarea.validity.tooLong');
-
-textarea.defaultValue = 'abcdef';
-shouldBe('textarea.value.length', '6');
-shouldBeFalse('textarea.validity.tooLong');
-
-debug('');
-debug('Dirty value and longer than maxLength');
-textarea = document.createElement('textarea');
-document.body.appendChild(textarea);
-textarea.defaultValue = 'abcde';
-textarea.maxLength = 3;
-textarea.focus();
-textarea.setSelectionRange(5, 5); // Move the cursor at the end.
-document.execCommand('delete');
-shouldBe('textarea.value.length', '4');
-shouldBeTrue('textarea.validity.tooLong');
-// Make the value <=maxLength.
-document.execCommand('delete');
-shouldBeFalse('textarea.validity.tooLong');
-
-debug('');
-debug('Sets a value via DOM property');
-textarea = document.createElement('textarea');
-document.body.appendChild(textarea);
-textarea.maxLength = 3;
-textarea.value = 'abcde';
-shouldBeFalse('textarea.validity.tooLong');
-
-debug('');
-debug('Disabled');
-textarea.disabled = true;
-shouldBeFalse('textarea.validity.tooLong');
-textarea.disabled = false;
-
-debug('');
-debug('Grapheme length is not greater than maxLength though character length is greater');
-// fancyX should be treated as 1 grapheme.
-// U+0305 COMBINING OVERLINE
-// U+0332 COMBINING LOW LINE
-var fancyX = "x\u0305\u0332";
-textarea = document.createElement('textarea');
-document.body.appendChild(textarea);
-textarea.value = fancyX; // 3 characters, 1 grapheme cluster.
-textarea.maxLength = 1;
-shouldBeFalse('textarea.validity.tooLong');
-
-debug('');
-debug('A value set by resetting a form doesn\'t make tooLong true.');
-// Make a dirty textarea.
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-parent.innerHTML = '<form><textarea maxlength=2>abcdef</textarea></form>';
-textarea = parent.firstChild.firstChild;
-textarea.focus();
-textarea.setSelectionRange(6, 6);
-document.execCommand('delete');
-shouldBeTrue('textarea.validity.tooLong');
-parent.firstChild.reset();
-shouldBe('textarea.value', '"abcdef"');
-shouldBeFalse('textarea.validity.tooLong');
-
-debug('');
-debug('A value set by a child node change doesn\'t make tooLong true.');
-parent.innerHTML = '<textarea maxlength=2>abc</textarea>';
-textarea = parent.firstChild;
-shouldBeFalse('textarea.validity.tooLong');
-parent.firstChild.innerHTML = 'abcdef';
-shouldBe('textarea.value', '"abcdef"');
-shouldBeFalse('textarea.validity.tooLong');
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js
deleted file mode 100644
index 3e32193..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js
+++ /dev/null
@@ -1,86 +0,0 @@
-description('This test aims to check for typeMismatch flag with type=date input fields');
-var i = document.createElement('input');
-i.type = 'date';
-
-function check(value, mismatchExpected, disabled)
-{
- i.value = value;
- i.disabled = !!disabled;
- var actual = i.validity.typeMismatch;
- var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' date string' + (disabled ? ' when disabled.' : '.');
- if (didPass)
- testPassed(resultText);
- else
- testFailed(resultText);
-}
-
-function shouldBeValid(value, disabled)
-{
- check(value, false, disabled);
-}
-
-function shouldBeInvalid(value)
-{
- check(value, true);
-}
-
-// Valid values
-shouldBeValid('');
-shouldBeValid('2009-09-07');
-shouldBeValid('9999-12-31');
-shouldBeValid('275760-09-13');
-shouldBeValid('1582-10-15');
-shouldBeValid('0001-01-01');
-shouldBeValid('2009-01-31');
-shouldBeValid('2009-02-28');
-shouldBeValid('2009-03-31');
-shouldBeValid('2009-04-30');
-shouldBeValid('2009-05-31');
-shouldBeValid('2009-06-30');
-shouldBeValid('2009-07-31');
-shouldBeValid('2009-08-31');
-shouldBeValid('2009-09-30');
-shouldBeValid('2009-10-31');
-shouldBeValid('2009-11-30');
-shouldBeValid('2009-12-31');
-shouldBeValid('2008-02-29');
-shouldBeValid('2000-02-29');
-
-// Invalid values
-shouldBeInvalid(' 2009-09-07 ');
-shouldBeInvalid('a');
-shouldBeInvalid('-1-09-07');
-shouldBeInvalid('0000-12-31');
-shouldBeInvalid('0000-01-01');
-shouldBeInvalid('275760-09-14');
-shouldBeInvalid('2147483648-12-31');
-shouldBeInvalid('2009/09/07');
-shouldBeInvalid('20090907');
-shouldBeInvalid('2009--2-07');
-shouldBeInvalid('2009-00-07');
-shouldBeInvalid('2009-13-07');
-shouldBeInvalid('2009-xx-30');
-shouldBeInvalid('2009-01-32');
-shouldBeInvalid('2009-02-29');
-shouldBeInvalid('2009-03-32');
-shouldBeInvalid('2009-04-31');
-shouldBeInvalid('2009-05-32');
-shouldBeInvalid('2009-06-31');
-shouldBeInvalid('2009-07-32');
-shouldBeInvalid('2009-08-32');
-shouldBeInvalid('2009-09-31');
-shouldBeInvalid('2009-10-32');
-shouldBeInvalid('2009-11-31');
-shouldBeInvalid('2009-12-32');
-shouldBeInvalid('2100-02-29');
-shouldBeInvalid('2009-09-00');
-shouldBeInvalid('2009-09-');
-shouldBeInvalid('2009-09-7');
-shouldBeInvalid('2009-09-001');
-shouldBeInvalid('2009-09-xx');
-shouldBeInvalid('2009-09');
-shouldBeInvalid('2009');
-
-// Disabled
-shouldBeValid('2009-09', true);
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js
deleted file mode 100644
index df41911..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js
+++ /dev/null
@@ -1,82 +0,0 @@
-description("Input type=url validation test");
-
-function check(value, mismatchExpected, disabled) {
- i.value = value;
- i.disabled = !!disabled;
- var actual = i.validity.typeMismatch;
- var didPass = actual == mismatchExpected;
- var resultText = value + ' is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' url' + (disabled ? ' when disabled.' : '.');
- if (didPass)
- testPassed(resultText);
- else
- testFailed(resultText);
-}
-
-function expectValid(value, disabled) {
- check(value, false, disabled);
-}
-
-function expectInvalid(value) {
- check(value, true);
-}
-
-var i = document.createElement('input');
-i.type = 'url';
-
-// Valid values
-expectValid('http://www.google.com');
-expectValid('http://foo:bar@www.google.com:80');
-expectValid('http://localhost');
-expectValid('http://127.0.0.1');
-expectValid('http://[0000:0000:0000:0000:0000:0000:7f00:0001]/');
-expectValid('http://[0000:0000:0000:0000:0000:0000:127.0.0.1]/');
-expectValid('http://[::7f00:0001]/');
-expectValid('http://[1::2:3]/');
-expectValid('http://[0000:0::ffff:10.0.0.1]/');
-expectValid('http://a');
-expectValid('http://www.google.com/search?rls=en&q=WebKit&ie=UTF-8&oe=UTF-8');
-expectValid('ftp://ftp.myhost.com');
-expectValid('ssh://ssh.myhost.com');
-expectValid('mailto:tkent@chromium.org');
-expectValid('mailto:tkent@chromium.org?body=hello');
-expectValid('file:///Users/tkent/.zshrc');
-expectValid('file:///C:/human.sys');
-expectValid('tel:+1-800-12345;ext=9999');
-expectValid('tel:03(1234)5678');
-expectValid('somescheme://ssh.myhost.com');
-expectValid('http://a/\\\/\'\'*<>/');
-expectValid('http://a/dfs/\kds@sds');
-expectValid('http://a.a:1/search?a&b');
-expectValid('http://www.google.com/#top');
-expectValid('http://\u30C6\u30B9\u30C8\u3002jp/\u30D1\u30B9?\u540D\u524D=\u5024');
-
-// Invalid values
-expectInvalid('www.google.com');
-expectInvalid('127.0.0.1');
-expectInvalid('.com');
-expectInvalid('http://www.google.com:aaaa');
-expectInvalid('://');
-expectInvalid('/http://www.google.com');
-expectInvalid('----ftp://a');
-expectInvalid('scheme//a');
-expectInvalid('http://[v8.:::]/');
-
-// KURL's host name restriction is stricter than RFC 3986. KURLGoogle is not.
-i.value = 'http://www.g**gle.com'
-var strictHost = i.validity.typeMismatch;
-if (strictHost) {
- expectInvalid('http:// www.google.com');
- expectInvalid('http://www .google.com');
- expectInvalid('http://www. google. com');
- expectInvalid('http://host+');
- expectInvalid('http://myurl!');
-} else {
- expectValid('http:// www.google.com');
- expectValid('http://www .google.com');
- expectValid('http://www. google. com');
- expectValid('http://host+');
- expectValid('http://myurl!');
-}
-
-// Disabled
-expectValid('invalid', true);
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-valueMissing-radio.js b/LayoutTests/fast/forms/script-tests/ValidityState-valueMissing-radio.js
deleted file mode 100644
index 4b0bb4a..0000000
--- a/LayoutTests/fast/forms/script-tests/ValidityState-valueMissing-radio.js
+++ /dev/null
@@ -1,76 +0,0 @@
-description('valueMissing tests for radio buttons');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-
-debug('Without form element');
-parent.innerHTML = '<input name=victim type=radio required>'
- + '<input name=victim type=radio>'
- + '<input name=victim type=radio>';
-var inputs = document.getElementsByName('victim');
-debug('No checked button:');
-shouldBeTrue('inputs[0].validity.valueMissing');
-shouldBeTrue('inputs[1].validity.valueMissing');
-shouldBeTrue('inputs[2].validity.valueMissing');
-debug('The second button has been checked:');
-inputs[1].checked = true;
-shouldBeFalse('inputs[0].validity.valueMissing');
-shouldBeFalse('inputs[1].validity.valueMissing');
-shouldBeFalse('inputs[2].validity.valueMissing');
-debug('The first button has been checked:');
-inputs[0].checked = true;
-shouldBeFalse('inputs[0].validity.valueMissing');
-shouldBeFalse('inputs[1].validity.valueMissing');
-shouldBeFalse('inputs[2].validity.valueMissing');
-debug('The third button has been checked:');
-inputs[2].checked = true;
-shouldBeFalse('inputs[0].validity.valueMissing');
-shouldBeFalse('inputs[1].validity.valueMissing');
-shouldBeFalse('inputs[2].validity.valueMissing');
-
-debug('');
-debug('With form element');
-parent.innerHTML = '<form>'
- + '<input name=victim type=radio required>'
- + '<input name=victim type=radio>'
- + '<input name=victim type=radio>'
- + '</form>';
-inputs = document.getElementsByName('victim');
-debug('No checked button:');
-shouldBeTrue('inputs[0].validity.valueMissing');
-shouldBeTrue('inputs[1].validity.valueMissing');
-shouldBeTrue('inputs[2].validity.valueMissing');
-debug('The first button has been checked:');
-inputs[0].checked = true;
-shouldBeFalse('inputs[0].validity.valueMissing');
-shouldBeFalse('inputs[1].validity.valueMissing');
-shouldBeFalse('inputs[2].validity.valueMissing');
-debug('The second button has been checked:');
-inputs[1].checked = true;
-shouldBeFalse('inputs[0].validity.valueMissing');
-shouldBeFalse('inputs[1].validity.valueMissing');
-shouldBeFalse('inputs[2].validity.valueMissing');
-debug('The third button has been checked:');
-inputs[2].checked = true;
-shouldBeFalse('inputs[0].validity.valueMissing');
-shouldBeFalse('inputs[1].validity.valueMissing');
-shouldBeFalse('inputs[2].validity.valueMissing');
-
-debug('');
-debug('Not in a radio button group');
-var requiredButton = document.createElement('input');
-requiredButton.type = 'radio';
-requiredButton.name = 'victim';
-requiredButton.required = true;
-shouldBeFalse('requiredButton.validity.valueMissing');
-
-parent.innerHTML = '<input name=victim type=radio required><input name=victim type=radio>';
-requiredButton = document.getElementsByName('victim')[0];
-var button = document.getElementsByName('victim')[1];
-shouldBeTrue('requiredButton.validity.valueMissing');
-shouldBeTrue('button.validity.valueMissing');
-parent.removeChild(button);
-shouldBeFalse('button.validity.valueMissing');
-parent.removeChild(requiredButton);
-shouldBeFalse('requiredButton.validity.valueMissing');
-
diff --git a/LayoutTests/fast/forms/script-tests/checkValidity-cancel.js b/LayoutTests/fast/forms/script-tests/checkValidity-cancel.js
deleted file mode 100644
index 30c04f0..0000000
--- a/LayoutTests/fast/forms/script-tests/checkValidity-cancel.js
+++ /dev/null
@@ -1,30 +0,0 @@
-description('Tests for checkValidity() with invalid event canceling');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-parent.innerHTML = '<form><input name=i required></form>';
-var form = parent.firstChild;
-var input = form.firstChild;
-
-debug('"invalid" event is not canceled.');
-var invalidFired = false;
-var nothingListener = {};
-nothingListener.handleEvent = function(event) {
- invalidFired = true;
-};
-shouldBeTrue('input.addEventListener("invalid", nothingListener, false); !input.checkValidity() && invalidFired');
-shouldBeTrue('invalidFired = false; !form.checkValidity() && invalidFired');
-input.removeEventListener('invalid', nothingListener, false);
-
-debug('');
-debug('"invalid" event is canceled.');
-invalidFired = false;
-var cancelListener = {};
-cancelListener.handleEvent = function(event) {
- invalidFired = true;
- event.preventDefault();
-};
-// Even if 'invalid' is canceled, the input.checkValidity() result is still false.
-shouldBeTrue('input.addEventListener("invalid", cancelListener, false); !input.checkValidity() && invalidFired');
-// form.checkValidity() also should be false.
-shouldBeTrue('invalidFired = false; !form.checkValidity() && invalidFired');
diff --git a/LayoutTests/fast/forms/script-tests/checkValidity-handler-updates-dom.js b/LayoutTests/fast/forms/script-tests/checkValidity-handler-updates-dom.js
deleted file mode 100644
index e88029a..0000000
--- a/LayoutTests/fast/forms/script-tests/checkValidity-handler-updates-dom.js
+++ /dev/null
@@ -1,86 +0,0 @@
-description('HTMLFormElement::checkValidity() with cases that event handlers called by checkValidity() updates DOM structure.')
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-
-// ----------------------------------------------------------------
-debug('The target form is removed.');
-parent.innerHTML = '<form id=f1><input name=i id=i required></form>';
-var handler = function(event) {
- parent.innerHTML = '';
-};
-document.getElementById('i').addEventListener('invalid', handler, false);
-// The specificiation doesn't define the behavior in this case.
-// It's ok if WebKit doesn't crash.
-shouldBeFalse('document.getElementById("f1").checkValidity()');
-
-// ----------------------------------------------------------------
-debug('');
-debug('A control to be checked is removed.');
-parent.innerHTML = '<form id=f1><input name=i1 id=i1 required><input name=i2 id=i2 required></form>';
-var handler1 = function(event) {
- document.getElementById('f1').removeChild(document.getElementById('i2'));
-};
-document.getElementById('i1').addEventListener('invalid', handler1, false);
-var handler2Called = false;
-var handler2 = function(event) {
- handler2Called = true;
-};
-document.getElementById('i2').addEventListener('invalid', handler2, false);
-shouldBeFalse('document.getElementById("f1").checkValidity()');
-// If the node was removed from the form, i2.checkValidity() is called, but an
-// invalid event is not fired because it is not in any documents.
-shouldBeFalse('handler2Called');
-
-// ----------------------------------------------------------------
-debug('');
-debug('A new control is added.');
-parent.innerHTML = '<form id=f1><input name=i1 id=i1 required></form>';
-handler2Called = false;
-handler2 = function(event) {
- handler2Called = true;
-};
-handler1 = function(event) {
- var input = document.createElement('input');
- input.name = 'i2';
- input.required = true;
- input.addEventListener('invalid', handler2, false);
- document.getElementById('f1').appendChild(input);
-};
-document.getElementById('i1').addEventListener('invalid', handler1, false);
-shouldBeFalse('document.getElementById("f1").checkValidity()');
-// If a new node is added to the form, checkValidity() doesn't handle it.
-shouldBeFalse('handler2Called');
-
-// ----------------------------------------------------------------
-debug('');
-debug('A control is moved to another form.');
-parent.innerHTML = '<form id=f1><input name=i1 id=i1 required><input name=i2 id=i2 required></form>'
- + '<form id=f2></form>';
-handler1 = function(event) {
- document.getElementById('f2').appendChild(document.getElementById('i2'));
-};
-document.getElementById('i1').addEventListener('invalid', handler1, false);
-handler2Called = false;
-handler2 = function(event) {
- handler2Called = true;
-};
-document.getElementById('i2').addEventListener('invalid', handler2, false);
-shouldBeFalse('document.getElementById("f1").checkValidity()');
-// The moved control is not checked.
-shouldBeFalse('handler2Called');
-
-// ----------------------------------------------------------------
-debug('');
-debug('A control is moved to another document.');
-parent.innerHTML = '<form id=f1><input name=i1 id=i1 required></form>';
-var doc2 = document.implementation.createHTMLDocument();
-handler1 = function(event) {
- doc2.body.appendChild(doc2.adoptNode(document.getElementById('i1')));
-};
-document.getElementById('i1').addEventListener('invalid', handler1, false);
-// i1 is not listed in 'unhandled invalid controls' because it was moved to
-// another document.
-shouldBeTrue('document.getElementById("f1").checkValidity()');
-
-parent.innerHTML = '';
diff --git a/LayoutTests/fast/forms/script-tests/form-attribute-elements-order.js b/LayoutTests/fast/forms/script-tests/form-attribute-elements-order.js
deleted file mode 100644
index 50dd404..0000000
--- a/LayoutTests/fast/forms/script-tests/form-attribute-elements-order.js
+++ /dev/null
@@ -1,151 +0,0 @@
-description("This test examines the order of the elements attribute of a form element.");
-
-var container = document.createElement('div');
-document.body.appendChild(container);
-container.innerHTML = '<input name=victim id=before1 form=owner />' +
- '<input name=victim id=before2 form=owner />' +
- '<form id=owner action= method=GET>' +
- ' <input name=victim id=inner1 form=owner />' +
- ' <input name=victim id=inner2 form=owner />' +
- '</form>' +
- '<input name=victim id=after1 form=owner />' +
- '<input name=victim id=after2 form=owner />';
-
-var owner = document.getElementById('owner');
-var before1 = document.getElementById('before1');
-var before2 = document.getElementById('before2');
-var inner1 = document.getElementById('inner1');
-var inner2 = document.getElementById('inner2');
-var after1 = document.getElementById('after1');
-var after2 = document.getElementById('after2');
-
-debug('- Test for the case where some elements are outside of the form.');
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
-
-debug('');
-debug('- Test for changing the value of the form attribute of a element which is located before the form owner.');
-before2.attributes['form'].value = '';
-shouldBe('owner.elements.length', '5');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'inner1');
-shouldBe('owner.elements[2]', 'inner2');
-shouldBe('owner.elements[3]', 'after1');
-shouldBe('owner.elements[4]', 'after2');
-before2.attributes['form'].value = 'owner';
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
-
-debug('');
-debug('- Test for changing the value of the form attribute of a element which is located inside of the form owner.');
-inner2.attributes['form'].value = '';
-shouldBe('owner.elements.length', '5');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'after1');
-shouldBe('owner.elements[4]', 'after2');
-inner2.attributes['form'].value = 'owner';
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
-
-debug('');
-debug('- Test for changing the value of the form attribute of a element which is located after the form owner.');
-after1.attributes['form'].value = '';
-shouldBe('owner.elements.length', '5');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after2');
-after1.attributes['form'].value = 'owner';
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
-
-debug('');
-debug('- Test for setting form attribute of elements in reverse order.');
-before1.attributes['form'].value = '';
-before2.attributes['form'].value = '';
-inner1.attributes['form'].value = '';
-inner2.attributes['form'].value = '';
-after1.attributes['form'].value = '';
-after2.attributes['form'].value = '';
-
-after2.attributes['form'].value = 'owner';
-after1.attributes['form'].value = 'owner';
-inner2.attributes['form'].value = 'owner';
-inner1.attributes['form'].value = 'owner';
-before2.attributes['form'].value = 'owner';
-before1.attributes['form'].value = 'owner';
-
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
-
-debug('');
-debug('- Test for setting form attribute of elements in random order.');
-before1.attributes['form'].value = '';
-before2.attributes['form'].value = '';
-inner1.attributes['form'].value = '';
-inner2.attributes['form'].value = '';
-after1.attributes['form'].value = '';
-after2.attributes['form'].value = '';
-
-after1.attributes['form'].value = 'owner';
-before1.attributes['form'].value = 'owner';
-inner2.attributes['form'].value = 'owner';
-before2.attributes['form'].value = 'owner';
-after2.attributes['form'].value = 'owner';
-inner1.attributes['form'].value = 'owner';
-
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
-
-debug('');
-debug('- Test for removing/adding elements');
-container.removeChild(before2);
-owner.removeChild(inner2);
-container.removeChild(after1);
-shouldBe('owner.elements.length', '3');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'inner1');
-shouldBe('owner.elements[2]', 'after2');
-container.insertBefore(before2, owner);
-owner.appendChild(inner2);
-container.insertBefore(after1, after2);
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before1');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner1');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after1');
-shouldBe('owner.elements[5]', 'after2');
diff --git a/LayoutTests/fast/forms/script-tests/form-attribute-elements-order2.js b/LayoutTests/fast/forms/script-tests/form-attribute-elements-order2.js
deleted file mode 100644
index 0150bd7..0000000
--- a/LayoutTests/fast/forms/script-tests/form-attribute-elements-order2.js
+++ /dev/null
@@ -1,96 +0,0 @@
-description("This test examines the order of the elements attribute of a form element with form-associated elements with form attribute or witout form attibute.");
-
-var container = document.createElement('div');
-document.body.appendChild(container);
-
-debug('');
-debug('- Test for the case where some elements have form attribute but some others not.');
-container.innerHTML = '<form id=owner>' +
- ' <input id=input1 name=victim />' +
- ' <input id=input2 name=victim form=owner />' +
- ' <input id=input3 name=victim />' +
- '</form>';
-var owner = document.getElementById('owner');
-var input1 = document.getElementById('input1');
-var input2 = document.getElementById('input2');
-var input3 = document.getElementById('input3');
-shouldBe('owner.elements.length', '3');
-shouldBe('owner.elements[0]', 'input1');
-shouldBe('owner.elements[1]', 'input2');
-shouldBe('owner.elements[2]', 'input3');
-
-container.innerHTML = '<form id=owner>' +
- ' <input id=input1 name=victim form=owner />' +
- ' <input id=input2 name=victim />' +
- ' <input id=input3 name=victim form=owner />' +
- '</form>';
-owner = document.getElementById('owner');
-input1 = document.getElementById('input1');
-input2 = document.getElementById('input2');
-input3 = document.getElementById('input3');
-shouldBe('owner.elements.length', '3');
-shouldBe('owner.elements[0]', 'input1');
-shouldBe('owner.elements[1]', 'input2');
-shouldBe('owner.elements[2]', 'input3');
-
-debug('');
-debug('- Test for inserting/removing a form-associated element without form attribute.');
-container.innerHTML = '<input name=victim id=before form=owner />' +
- '<form id=owner action= method=GET>' +
- ' <input name=victim id=inner />' +
- '</form>' +
- '<input name=victim id=after form=owner />';
-owner = document.getElementById('owner');
-var before = document.getElementById('before');
-var inner = document.getElementById('inner');
-var after = document.getElementById('after');
-
-var inner2 = document.createElement('input');
-inner2.name = 'victim';
-inner2.id = 'inner2';
-owner.appendChild(inner2);
-shouldBe('owner.elements.length', '4');
-shouldBe('owner.elements[0]', 'before');
-shouldBe('owner.elements[1]', 'inner');
-shouldBe('owner.elements[2]', 'inner2');
-shouldBe('owner.elements[3]', 'after');
-
-owner.removeChild(inner);
-owner.insertBefore(inner, inner2);
-shouldBe('owner.elements.length', '4');
-shouldBe('owner.elements[0]', 'before');
-shouldBe('owner.elements[1]', 'inner');
-shouldBe('owner.elements[2]', 'inner2');
-shouldBe('owner.elements[3]', 'after');
-
-debug('');
-debug('- Test for inserting/removing a form-associated element with form attribute.');
-var before2 = document.createElement('input');
-before2.name = 'victim';
-before2.id = 'before2';
-before2.setAttribute('form', 'owner');
-container.insertBefore(before2, owner);
-var after2 = document.createElement('input');
-after2.name = 'victim';
-after2.id = 'after2';
-after2.setAttribute('form', 'owner');
-container.appendChild(after2);
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after');
-shouldBe('owner.elements[5]', 'after2');
-
-container.removeChild(before);
-container.removeChild(after);
-container.insertBefore(before, before2);
-container.insertBefore(after, after2);
-shouldBe('owner.elements.length', '6');
-shouldBe('owner.elements[0]', 'before');
-shouldBe('owner.elements[1]', 'before2');
-shouldBe('owner.elements[2]', 'inner');
-shouldBe('owner.elements[3]', 'inner2');
-shouldBe('owner.elements[4]', 'after');
-shouldBe('owner.elements[5]', 'after2');
diff --git a/LayoutTests/fast/forms/script-tests/form-attribute-elements.js b/LayoutTests/fast/forms/script-tests/form-attribute-elements.js
deleted file mode 100644
index 2afcc03..0000000
--- a/LayoutTests/fast/forms/script-tests/form-attribute-elements.js
+++ /dev/null
@@ -1,40 +0,0 @@
-description("This test checks a form element can handle elements of which form attribute points the form element even if elements are outside of the form.");
-
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-var container = document.createElement('div');
-document.body.appendChild(container);
-
-container.innerHTML = '<input type=hidden name=key1 value=value1 id=outer-before form=owner />' +
- '<form id=owner action="" method="GET">' +
- ' <input type=hidden name=key2 value=value2 id=inner form=owner />' +
- '</form>' +
- '<input type=hidden name=submitted value=true id=outer-after form=owner />';
-
-var owner = document.getElementById('owner');
-var outerBefore = document.getElementById('outer-before');
-var inner = document.getElementById('inner');
-var outerAfter = document.getElementById('outer-after');
-var query = window.location.search;
-
-if (query.indexOf('submitted=true') == -1) {
- owner.submit();
-} else {
- debug('- Ensures that elements attribute of the form contains elements which are outside of the form.');
-
- shouldBe('owner.elements.length', '3');
- shouldBe('owner.elements[0]', 'outerBefore');
- shouldBe('owner.elements[1]', 'inner');
- shouldBe('owner.elements[2]', 'outerAfter');
-
- debug('');
- debug('- Ensures that form submission contains name and value pairs for such elements.');
- var pairs = query.substr(1).split('&');
- shouldBe('pairs.length', '3');
- shouldBeEqualToString('pairs[0]', 'key1=value1');
- shouldBeEqualToString('pairs[1]', 'key2=value2');
- shouldBeEqualToString('pairs[2]', 'submitted=true');
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
diff --git a/LayoutTests/fast/forms/script-tests/form-attribute.js b/LayoutTests/fast/forms/script-tests/form-attribute.js
deleted file mode 100644
index e2a9759..0000000
--- a/LayoutTests/fast/forms/script-tests/form-attribute.js
+++ /dev/null
@@ -1,133 +0,0 @@
-description("This test checks the form attribute of the form-associated elements.");
-
-var container = document.createElement('div');
-document.body.appendChild(container);
-
-debug('- Checks the existence of the form attribute for each form-associated elements.');
-debug('FIXME: <label> doesn\'t support the form attribute for now.');
-container.innerHTML = '<form id=owner></form>' +
- '<button name=victim form=owner />' +
- '<fieldset name=victim form=owner />' +
- '<input name=victim form=owner />' +
- '<keygen name=victim form=owner />' +
- '<label name=victim form=owner />' +
- '<meter name=victim form=owner />' +
- '<object name=victim form=owner></object>' +
- '<output name=victim form=owner />' +
- '<progress name=victim form=owner />' +
- '<select name=victim form=owner />' +
- '<textarea name=victim form=owner />';
-
-var owner = document.getElementById('owner');
-shouldBe('document.getElementsByTagName("button")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("fieldset")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("input")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("keygen")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("label")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("meter")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("object")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("output")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("progress")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("select")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("textarea")[0].form', 'owner');
-
-debug('');
-debug('- Ensures that the form attribute points the form owner even if the element is within another form element.');
-container.innerHTML = '<form id=owner></form>' +
- '<form id=shouldNotBeOwner>' +
- ' <input id=inputElement name=victim form=owner />' +
- '</form>';
-owner = document.getElementById('owner');
-var inputElement = document.getElementById('inputElement');
-shouldBe('inputElement.form', 'owner');
-
-debug('');
-debug('- Ensures that the form attribute of all form-associated element with or witout form attribute points the form owner.');
-container.innerHTML = '<form id=owner>' +
- ' <input id=inputElement1 name=victim />' +
- ' <input id=inputElement2 name=victim form=owner />' +
- ' <input id=inputElement3 name=victim />' +
- '</form>';
-owner = document.getElementById('owner');
-var inputElement1 = document.getElementById('inputElement1');
-var inputElement2 = document.getElementById('inputElement2');
-var inputElement3 = document.getElementById('inputElement3');
-shouldBe('inputElement1.form', 'owner');
-shouldBe('inputElement2.form', 'owner');
-shouldBe('inputElement3.form', 'owner');
-
-debug('');
-debug('- Ensures that the form attribute points the form owner even if the form element is nested another form element.');
-debug('NOTE: It seems that nesting form elements is not allowed so we ensure each form-associated elements associate with the outmost form element.');
-container.innerHTML = '<form id=owner>' +
- ' <form>' +
- ' <input id=inputElement1 name=victim form=owner />' +
- ' <input id=inputElement2 name=victim />' +
- ' <input id=inputElement3 name=victim form=owner />' +
- ' </form>' +
- '</form>';
-owner = document.getElementById('owner');
-inputElement1 = document.getElementById('inputElement1');
-inputElement2 = document.getElementById('inputElement2');
-inputElement3 = document.getElementById('inputElement3');
-shouldBe('inputElement1.form', 'owner');
-shouldBe('inputElement2.form', 'owner');
-shouldBe('inputElement3.form', 'owner');
-
-debug('');
-debug('- Ensures whether the form owner is set correctly when the value of form attribute of a form-associated element changed.');
-container.innerHTML = '<form id=form1></form>' +
- '<form id=form2></form>' +
- '<input id=inputElement name=victim form=form1 />' +
- '<object id=objectElement name=victim form=form1></object>';
-var form1 = document.getElementById('form1');
-var form2 = document.getElementById('form2');
-inputElement = document.getElementById('inputElement');
-shouldBe('inputElement.form', 'form1');
-inputElement.attributes['form'].value = 'form2';
-shouldBe('inputElement.form', 'form2');
-
-// HTMLObjectElement has its own implementation of formAttr processing and so needs its own test.
-objectElement = document.getElementById('objectElement');
-shouldBe('objectElement.form', 'form1');
-objectElement.attributes['form'].value = 'form2';
-shouldBe('objectElement.form', 'form2');
-
-debug('');
-debug('- Ensures whether the form owner is set correctly when the value of form attribute is added/removed.');
-container.innerHTML = '<form id=owner name=firstOwner></form>' +
- '<input id=inputElement name=victim />' +
- '<object id=objectElement name=victim></object>';
-owner = document.getElementById('owner');
-inputElement = document.getElementById('inputElement');
-shouldBe('inputElement.form', 'null');
-var formAttribute = document.createAttribute('form');
-inputElement.setAttribute('form', 'owner');
-shouldBe('inputElement.form', 'owner');
-inputElement.removeAttribute('form');
-shouldBe('inputElement.form', 'null');
-
-// HTMLObjectElement has its own implementation of formAttr processing and so needs its own test.
-objectElement = document.getElementById('objectElement');
-shouldBe('objectElement.form', 'null');
-objectElement.setAttribute('form', 'owner');
-shouldBe('objectElement.form', 'owner');
-objectElement.removeAttribute('form');
-shouldBe('objectElement.form', 'null');
-
-debug('');
-debug('- Ensures whether the form owner is set correctly when the form owner is added/removed.');
-container.innerHTML = '<form id=owner name=firstOwner></form>' +
- '<form id=owner name=secondOwner></form>' +
- '<input id=inputElement name=victim form=owner />';
-owner = document.getElementById('owner');
-shouldBeEqualToString('owner.name', 'firstOwner');
-inputElement = document.getElementById('inputElement');
-container.removeChild(owner);
-owner = document.getElementById('owner');
-shouldBeEqualToString('owner.name', 'secondOwner');
-shouldBe('inputElement.form', 'owner');
-container.removeChild(owner);
-shouldBe('inputElement.form', 'null');
-container.appendChild(owner);
-shouldBe('inputElement.form', 'owner');
diff --git a/LayoutTests/fast/forms/script-tests/form-collection-elements-order.js b/LayoutTests/fast/forms/script-tests/form-collection-elements-order.js
deleted file mode 100644
index fdb6678..0000000
--- a/LayoutTests/fast/forms/script-tests/form-collection-elements-order.js
+++ /dev/null
@@ -1,98 +0,0 @@
-description("This test examines the order of form associated elements which are classified as 'listed'.");
-
-var container = document.createElement('div');
-document.body.appendChild(container);
-var owner;
-
-function checkOrder(victims) {
- if (owner.elements.length != victims.length)
- return 'length mismatch, elements.length = ' + owner.elements.length +
- ', expected length = ' + victims.length;
- for (var i = 0; i < victims.length; ++i)
- if (owner.elements[i] != victims[i])
- return 'element mismatch at index ' + i;
- return 'OK';
-}
-
-debug('- Checks the order of form associated elements.');
-container.innerHTML = '<form id=owner>' +
- '<button name=victim></button>' +
- '<fieldset name=victim>Test</fieldset>' +
- '<input name=victim/>' +
- '<keygen name=victim></keygen>' +
- '<label name=victim></label>' +
- '<meter name=victim></meter>' +
- '<object name=victim></object>' +
- '<output name=victim></output>' +
- '<progress name=victim></progress>' +
- '<select name=victim></select>' +
- '<textarea name=victim></textarea>'+
- '</form>';
-owner = document.getElementById('owner');
-var button = document.getElementsByTagName('button')[0];
-var fieldset = document.getElementsByTagName('fieldset')[0];
-var input = document.getElementsByTagName('input')[0];
-var keygen = document.getElementsByTagName('keygen')[0];
-var label = document.getElementsByTagName('label')[0];
-var meter = document.getElementsByTagName('meter')[0];
-var object = document.getElementsByTagName('object')[0];
-var output = document.getElementsByTagName('output')[0];
-var progress = document.getElementsByTagName('progress')[0];
-var select = document.getElementsByTagName('select')[0];
-var textarea = document.getElementsByTagName('textarea')[0];
-shouldBe('checkOrder([button, fieldset, input, keygen, object, output, select, textarea])', '"OK"');
-
-debug('');
-debug('- Checks the order after some elements removed/inserted.');
-owner.removeChild(object);
-shouldBe('checkOrder([button, fieldset, input, keygen, output, select, textarea])', '"OK"');
-owner.removeChild(button);
-shouldBe('checkOrder([fieldset, input, keygen, output, select, textarea])', '"OK"');
-owner.insertBefore(object, fieldset);
-shouldBe('checkOrder([object, fieldset, input, keygen, output, select, textarea])', '"OK"');
-owner.appendChild(button);
-shouldBe('checkOrder([object, fieldset, input, keygen, output, select, textarea, button])', '"OK"');
-
-debug('');
-debug('- Checks the order of form associated elements with form attribute.');
-container.innerHTML = '<button name=victim form=owner></button>' +
- '<fieldset name=victim form=owner>Test</fieldset>' +
- '<input name=victim form=owner />' +
- '<keygen name=victim form=owner></keygen>' +
- '<form id=owner>' +
- '<label name=victim></label>' +
- '<meter name=victim></meter>' +
- '<object name=victim></object>' +
- '</form>' +
- '<output name=victim form=owner></output>' +
- '<progress name=victim form=owner></progress>' +
- '<select name=victim form=owner></select>' +
- '<textarea name=victim form=owner></textarea>';
-owner = document.getElementById('owner');
-button = document.getElementsByTagName('button')[0];
-fieldset = document.getElementsByTagName('fieldset')[0];
-input = document.getElementsByTagName('input')[0];
-keygen = document.getElementsByTagName('keygen')[0];
-label = document.getElementsByTagName('label')[0];
-meter = document.getElementsByTagName('meter')[0];
-object = document.getElementsByTagName('object')[0];
-output = document.getElementsByTagName('output')[0];
-progress = document.getElementsByTagName('progress')[0];
-select = document.getElementsByTagName('select')[0];
-textarea = document.getElementsByTagName('textarea')[0];
-shouldBe('checkOrder([button, fieldset, input, keygen, object, output, select, textarea])', '"OK"');
-
-debug('');
-debug('- Checks the order after some elements removed/inserted with form attribute.');
-owner.removeChild(object);
-shouldBe('checkOrder([button, fieldset, input, keygen, output, select, textarea])', '"OK"');
-container.removeChild(button);
-shouldBe('checkOrder([fieldset, input, keygen, output, select, textarea])', '"OK"');
-container.removeChild(textarea);
-shouldBe('checkOrder([fieldset, input, keygen, output, select])', '"OK"');
-owner.appendChild(object);
-shouldBe('checkOrder([fieldset, input, keygen, object, output, select])', '"OK"');
-container.insertBefore(textarea, fieldset);
-shouldBe('checkOrder([textarea, fieldset, input, keygen, object, output, select])', '"OK"');
-container.appendChild(button);
-shouldBe('checkOrder([textarea, fieldset, input, keygen, object, output, select, button])', '"OK"');
diff --git a/LayoutTests/fast/forms/script-tests/form-collection-elements.js b/LayoutTests/fast/forms/script-tests/form-collection-elements.js
deleted file mode 100644
index 21f19d8..0000000
--- a/LayoutTests/fast/forms/script-tests/form-collection-elements.js
+++ /dev/null
@@ -1,65 +0,0 @@
-description("This test lists all the elements of a form per http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-listed.");
-debug("This test does not add object element as a listed element. Separate test will cover that.");
-
-var container = document.createElement('div');
-document.body.appendChild(container);
-
-container.innerHTML = '<form id="form1">' +
- '<button id=button1></button>' +
- '<fieldset id=fieldset1><legend id=legend1></legend></fieldset>' +
- '<input id=inputhidden type=hidden>' +
- '<input id=inputtext type=text>' +
- '<input id=inputsearch type=search>' +
- '<input id=inputurl type=url>' +
- '<input id=inputemail type=email>' +
- '<input id=inputpassword type=password>' +
- '<input id=inputdate type=date>' +
- '<input id=inputnumber type=number>' +
- '<input id=inputrange type=range>' +
- '<input id=inputcolor type=color>' +
- '<input id=inputcheckbox type=checkbox>' +
- '<input id=inputradio type=radio>' +
- '<input id=inputfile type=file>' +
- '<input id=inputsubmit type=submit>' +
- '<input id=inputimage type=image>' +
- '<input id=inputreset type=reset>' +
- '<input id=inputbutton type=button>' +
- '<keygen id=keygen1></keygen>' +
- '<label id=label1></label>' +
- '<meter id=meter1></meter>' +
- '<object id=object1></object>' +
- '<output id=output1></output>' +
- '<progress id=progress1></progress>' +
- '<select id=select1>' +
- ' <optgroup id=optgroup1>group1</optgroup>' +
- ' <option id=option1>option1</option>' +
- '</select>' +
- '<textarea id=textarea1></textarea>' +
- '</form>';
-
-var owner = document.getElementById('form1');
-
-shouldBe('owner.elements.length', '23');
-shouldBe('owner.elements[0].id', "'button1'");
-shouldBe('owner.elements[1].id', "'fieldset1'");
-shouldBe('owner.elements[2].id', "'inputhidden'");
-shouldBe('owner.elements[3].id', "'inputtext'");
-shouldBe('owner.elements[4].id', "'inputsearch'");
-shouldBe('owner.elements[5].id', "'inputurl'");
-shouldBe('owner.elements[6].id', "'inputemail'");
-shouldBe('owner.elements[7].id', "'inputpassword'");
-shouldBe('owner.elements[8].id', "'inputdate'");
-shouldBe('owner.elements[9].id', "'inputnumber'");
-shouldBe('owner.elements[10].id', "'inputrange'");
-shouldBe('owner.elements[11].id', "'inputcolor'");
-shouldBe('owner.elements[12].id', "'inputcheckbox'");
-shouldBe('owner.elements[13].id', "'inputradio'");
-shouldBe('owner.elements[14].id', "'inputfile'");
-shouldBe('owner.elements[15].id', "'inputsubmit'");
-shouldBe('owner.elements[16].id', "'inputreset'");
-shouldBe('owner.elements[17].id', "'inputbutton'");
-shouldBe('owner.elements[18].id', "'keygen1'");
-shouldBe('owner.elements[19].id', "'object1'");
-shouldBe('owner.elements[20].id', "'output1'");
-shouldBe('owner.elements[21].id', "'select1'");
-shouldBe('owner.elements[22].id', "'textarea1'");
diff --git a/LayoutTests/fast/forms/script-tests/formnovalidate-attribute.js b/LayoutTests/fast/forms/script-tests/formnovalidate-attribute.js
deleted file mode 100644
index eb13a60..0000000
--- a/LayoutTests/fast/forms/script-tests/formnovalidate-attribute.js
+++ /dev/null
@@ -1,41 +0,0 @@
-description("This test performs some simple check on the formnovalidate attribute.");
-
-var i = document.createElement("input");
-var b = document.createElement("button");
-
-shouldBe("i.hasAttribute('formNoValidate')", "false");
-shouldBe("i.getAttribute('formNoValidate')", "null");
-shouldBe("i.formNoValidate", "false");
-shouldBe("b.hasAttribute('formNoValidate')", "false");
-shouldBe("b.getAttribute('formNoValidate')", "null");
-shouldBe("b.formNoValidate", "false");
-
-i.formNoValidate = true;
-b.formNoValidate = true;
-
-shouldBe("i.hasAttribute('formNoValidate')", "true");
-shouldBe("i.getAttribute('formNoValidate')", "''");
-shouldBe("i.formNoValidate", "true");
-shouldBe("b.hasAttribute('formNoValidate')", "true");
-shouldBe("b.getAttribute('formNoValidate')", "''");
-shouldBe("b.formNoValidate", "true");
-
-var i2 = document.createElement("input");
-i2.formNoValidate = i.formNoValidate;
-
-i.formNoValidate = false;
-b.formNoValidate = false;
-
-shouldBe("i.hasAttribute('formNoValidate')", "false");
-shouldBe("i.getAttribute('formNoValidate')", "null");
-shouldBe("i.formNoValidate", "false");
-shouldBe("b.hasAttribute('formNoValidate')", "false");
-shouldBe("b.getAttribute('formNoValidate')", "null");
-shouldBe("b.formNoValidate", "false");
-
-i2.formNoValidate = false;
-shouldBe("i2.formNoValidate", "false");
-i2.formNoValidate = "something";
-shouldBe("i2.hasAttribute('formNoValidate')", "true");
-shouldBe("i2.getAttribute('formNoValidate')", "''");
-shouldBe("i2.formNoValidate", "true");
diff --git a/LayoutTests/fast/forms/script-tests/incremental-dom-property.js b/LayoutTests/fast/forms/script-tests/incremental-dom-property.js
deleted file mode 100644
index 82d32c7..0000000
--- a/LayoutTests/fast/forms/script-tests/incremental-dom-property.js
+++ /dev/null
@@ -1,15 +0,0 @@
-description('Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=50335">https://bugs.webkit.org/show_bug.cgi?id=50335</a>');
-
-var input = document.createElement('input');
-
-input.setAttribute('incremental', '')
-shouldBeTrue('input.incremental');
-
-input.removeAttribute('incremental');
-shouldBeFalse('input.incremental');
-
-input.incremental = true;
-shouldBeTrue('input.hasAttribute("incremental")');
-
-input.incremental = false;
-shouldBeFalse('input.hasAttribute("incremental")');
diff --git a/LayoutTests/fast/forms/script-tests/input-maxlength-ime-completed.js b/LayoutTests/fast/forms/script-tests/input-maxlength-ime-completed.js
deleted file mode 100644
index ad6bead..0000000
--- a/LayoutTests/fast/forms/script-tests/input-maxlength-ime-completed.js
+++ /dev/null
@@ -1,12 +0,0 @@
-description('There was a bug that users could input text longer than maxlength via IME. This test confirms it was fixed.');
-
-var input = document.createElement('input');
-input.maxLength = 2;
-document.body.appendChild(input);
-input.focus();
-textInputController.setMarkedText('abcd', 0, 4);
-textInputController.insertText('abcd'); // Debug WebKit crashed by this without the change of bug#25253.
-// Check the current value without input.value.
-// In Release WebKit, input.value was 'ab' though the user-visible value was 'abcd'.
-document.execCommand('SelectAll');
-shouldBe('document.getSelection().toString()', '"ab"');
diff --git a/LayoutTests/fast/forms/script-tests/input-maxlength-ime-preedit.js b/LayoutTests/fast/forms/script-tests/input-maxlength-ime-preedit.js
deleted file mode 100644
index cb7d37f..0000000
--- a/LayoutTests/fast/forms/script-tests/input-maxlength-ime-preedit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-description('This test checks users can input pre-edit text longer than maxlength.');
-
-var input = document.createElement('input');
-document.body.appendChild(input);
-input.maxLength = 2;
-input.focus();
-textInputController.setMarkedText('abcd', 0, 4);
-// The selection should have 4 characters though maxLength is 2.
-shouldBe('document.getSelection().toString()', '"abcd"');
diff --git a/LayoutTests/fast/forms/script-tests/input-maxlength-unsupported.js b/LayoutTests/fast/forms/script-tests/input-maxlength-unsupported.js
deleted file mode 100644
index f21cd4e..0000000
--- a/LayoutTests/fast/forms/script-tests/input-maxlength-unsupported.js
+++ /dev/null
@@ -1,11 +0,0 @@
-description('A test for maxlength attribute of an input element with non-text type');
-
-var input = document.createElement('input');
-input.maxLength = 2;
-input.type = 'number';
-document.body.appendChild(input);
-input.focus();
-document.execCommand('insertText', false, '1234');
-shouldBe('input.value', '"1234"');
-
-input.parentNode.removeChild(input);
diff --git a/LayoutTests/fast/forms/script-tests/input-minmax.js b/LayoutTests/fast/forms/script-tests/input-minmax.js
deleted file mode 100644
index 33a66f7..0000000
--- a/LayoutTests/fast/forms/script-tests/input-minmax.js
+++ /dev/null
@@ -1,79 +0,0 @@
-description('Tests the behavior of .min and .max of HTMLInputElement.');
-
-var input = document.createElement('input');
-
-// .min and .max just reflect the corresponding attributes.
-input.type = 'text';
-shouldBe('input.min', '""');
-shouldBe('input.max', '""');
-input.setAttribute('min', '0');
-input.setAttribute('max', '100');
-shouldBe('input.min', '"0"');
-shouldBe('input.max', '"100"');
-input.setAttribute('min', 'abc');
-input.setAttribute('max', 'qwerty');
-shouldBe('input.min', '"abc"');
-shouldBe('input.max', '"qwerty"');
-
-input.min = 'foo';
-input.max = 'bar';
-shouldBe('input.getAttribute("min")', '"foo"');
-shouldBe('input.getAttribute("max")', '"bar"');
-input.min = '';
-input.max = '';
-shouldBe('input.getAttribute("min")', '""');
-shouldBe('input.getAttribute("max")', '""');
-
-// Null.
-debug('Setting null to min:');
-input.min = null;
-shouldBe('input.min', '""');
-shouldBe('input.getAttribute("min")', 'null');
-input.setAttribute('min', null);
-shouldBe('input.min', '"null"');
-
-debug('Setting null to max:');
-input.max = null;
-shouldBe('input.max', '""');
-shouldBe('input.getAttribute("max")', 'null');
-input.setAttribute('max', null);
-shouldBe('input.max', '"null"');
-
-// Undefined.
-debug('Setting undefined to min:');
-input.min = undefined;
-shouldBe('input.min', '"undefined"');
-shouldBe('input.getAttribute("min")', '"undefined"');
-input.setAttribute('min', undefined);
-shouldBe('input.min', '"undefined"');
-
-debug('Setting undefined to max:');
-input.max = undefined;
-shouldBe('input.max', '"undefined"');
-shouldBe('input.getAttribute("max")', '"undefined"');
-input.setAttribute('max', undefined);
-shouldBe('input.max', '"undefined"');
-
-// Non-string.
-debug('Setting non-string to min:');
-input.min = 256;
-shouldBe('input.min', '"256"');
-shouldBe('input.getAttribute("min")', '"256"');
-input.setAttribute('min', 256);
-shouldBe('input.min', '"256"');
-
-debug('Setting non-string to max:');
-input.max = 256;
-shouldBe('input.max', '"256"');
-shouldBe('input.getAttribute("max")', '"256"');
-input.setAttribute('max', 256);
-shouldBe('input.max', '"256"');
-
-// The range type has the default minimum and the default maximum.
-// But they aren't exposed by .min .max IDL attributes.
-debug('Check implicit min/max of type=range:');
-input.type = 'range';
-input.setAttribute('min', '');
-input.setAttribute('max', '');
-shouldBe('input.min', '""');
-shouldBe('input.max', '""');
diff --git a/LayoutTests/fast/forms/script-tests/input-pattern.js b/LayoutTests/fast/forms/script-tests/input-pattern.js
deleted file mode 100644
index 399e40f..0000000
--- a/LayoutTests/fast/forms/script-tests/input-pattern.js
+++ /dev/null
@@ -1,34 +0,0 @@
-description('Test the behavior of pattern attribute and pattern DOM property.');
-
-var input = document.createElement('input');
-input.type = 'text';
-
-// No pattern attribute.
-shouldBe('input.pattern', '""');
-
-// Set a string value.
-input.pattern = 'foo';
-shouldBe('input.getAttribute("pattern")', '"foo"');
-input.setAttribute('pattern', 'bar');
-shouldBe('input.pattern', '"bar"');
-
-// Null.
-input.pattern = null;
-shouldBe('input.pattern', '""');
-shouldBe('input.getAttribute("pattern")', 'null');
-input.setAttribute('pattern', null);
-shouldBe('input.pattern', '"null"');
-
-// Undefined.
-input.pattern = undefined;
-shouldBe('input.pattern', '"undefined"');
-shouldBe('input.getAttribute("pattern")', '"undefined"');
-input.setAttribute('pattern', undefined);
-shouldBe('input.pattern', '"undefined"');
-
-// Non-string.
-input.pattern = 256;
-shouldBe('input.pattern', '"256"');
-shouldBe('input.getAttribute("pattern")', '"256"');
-input.setAttribute('pattern', 256);
-shouldBe('input.pattern', '"256"');
diff --git a/LayoutTests/fast/forms/script-tests/input-step.js b/LayoutTests/fast/forms/script-tests/input-step.js
deleted file mode 100644
index 9f222cb..0000000
--- a/LayoutTests/fast/forms/script-tests/input-step.js
+++ /dev/null
@@ -1,34 +0,0 @@
-description('Test the behavior of step attribute and step DOM property.');
-
-var input = document.createElement('input');
-input.type = 'number';
-
-// No step attribute.
-shouldBe('input.step', '""');
-
-// Set an invalid step value.
-input.step = 'foo';
-shouldBe('input.getAttribute("step")', '"foo"');
-input.setAttribute('step', 'bar');
-shouldBe('input.step', '"bar"');
-
-// Null.
-input.step = null;
-shouldBe('input.step', '""');
-shouldBe('input.getAttribute("step")', 'null');
-input.setAttribute('step', null);
-shouldBe('input.step', '"null"');
-
-// Undefined.
-input.step = undefined;
-shouldBe('input.step', '"undefined"');
-shouldBe('input.getAttribute("step")', '"undefined"');
-input.setAttribute('step', undefined);
-shouldBe('input.step', '"undefined"');
-
-// Non-string.
-input.step = 256;
-shouldBe('input.step', '"256"');
-shouldBe('input.getAttribute("step")', '"256"');
-input.setAttribute('step', 256);
-shouldBe('input.step', '"256"');
diff --git a/LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js b/LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js
deleted file mode 100644
index 750ea12..0000000
--- a/LayoutTests/fast/forms/script-tests/input-stepup-stepdown.js
+++ /dev/null
@@ -1,11 +0,0 @@
-description('Check stepUp() and stepDown() bahevior for unsupported types.');
-
-var input = document.createElement('input');
-var invalidStateErr = '"Error: INVALID_STATE_ERR: DOM Exception 11"';
-
-debug('Unsupported type');
-input.type = 'text';
-shouldThrow('input.step = "3"; input.min = ""; input.max = ""; input.value = "2"; input.stepDown()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
-shouldThrow('input.stepDown(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
-shouldThrow('input.stepUp()', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
-shouldThrow('input.stepUp(0)', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
diff --git a/LayoutTests/fast/forms/script-tests/input-type-change3.js b/LayoutTests/fast/forms/script-tests/input-type-change3.js
deleted file mode 100644
index 3af6469..0000000
--- a/LayoutTests/fast/forms/script-tests/input-type-change3.js
+++ /dev/null
@@ -1,47 +0,0 @@
-description('Tests for writing and reading .type property of HTMLInputElement.');
-
-var input = document.createElement('input');
-document.body.appendChild(input);
-
-// The default type is "text".
-shouldBe('input.type', '"text"');
-
-function check(value, expected)
-{
- input.type = value;
- if (input.type == expected)
- testPassed('input.type for "' + value + '" is correctly "' + input.type + '".');
- else
- testFailed('input.type for "' + value + '" is incorrectly "' + input.type + '", should be "' + expected + '".');
-}
-
-// The type is not specified explicitly. We can change it to "file".
-check("file", "file");
-// http://webkit.org/b/57343
-check("file", "file");
-check("FILE", "file");
-
-check("text", "text");
-check("TEXT", "text"); // input.type must return a lower case value according to DOM Level 2.
-check(" text ", "text");
-check("button", "button");
-check(" button ", "text");
-check("checkbox", "checkbox");
-check("email", "email");
-check("file", "email"); // We can't change a concrete type to file for a security reason.
-check("hidden", "hidden");
-check("image", "image");
-check("isindex", "text");
-check("number", "number");
-check("password", "password");
-check("passwd", "text");
-check("radio", "radio");
-check("range", "range");
-check("reset", "reset");
-check("search", "search");
-check("submit", "submit");
-check("tel", "tel");
-check("telephone", "text");
-check("url", "url");
-check("uri", "text");
-
diff --git a/LayoutTests/fast/forms/script-tests/input-valueasnumber-unsupported.js b/LayoutTests/fast/forms/script-tests/input-valueasnumber-unsupported.js
deleted file mode 100644
index 64a08c3..0000000
--- a/LayoutTests/fast/forms/script-tests/input-valueasnumber-unsupported.js
+++ /dev/null
@@ -1,30 +0,0 @@
-description('Tests for .valueAsNumber with non-supported input types.');
-
-var input = document.createElement('input');
-input.type = 'range';
-document.body.appendChild(input);
-
-function checkValueAsNumber(type) {
- debug('Check for type=' + type);
- input.value = '0';
- input.type = type;
- shouldBe('input.valueAsNumber', 'Number.NaN');
- shouldThrow('input.valueAsNumber = 0', '"Error: INVALID_STATE_ERR: DOM Exception 11"');
-}
-
-checkValueAsNumber('button');
-checkValueAsNumber('checkbox');
-checkValueAsNumber('color');
-checkValueAsNumber('email');
-checkValueAsNumber('file');
-checkValueAsNumber('hidden');
-checkValueAsNumber('image');
-checkValueAsNumber('khtml_isindex');
-checkValueAsNumber('password');
-checkValueAsNumber('radio');
-checkValueAsNumber('reset');
-checkValueAsNumber('search');
-checkValueAsNumber('submit');
-checkValueAsNumber('tel');
-checkValueAsNumber('text');
-checkValueAsNumber('url');
diff --git a/LayoutTests/fast/forms/script-tests/labels-add-htmlFor-label.js b/LayoutTests/fast/forms/script-tests/labels-add-htmlFor-label.js
deleted file mode 100644
index 0a74ba7..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-add-htmlFor-label.js
+++ /dev/null
@@ -1,35 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when adding a label whose htmlFor points to that control. ');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"><button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
-
-document.body.appendChild(parent);
-
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-label.htmlFor = "id1";
-document.getElementById("div1").appendChild(label);
-shouldBe('labels.length', '1');
-
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-label.htmlFor = "id2";
-document.getElementById("div1").appendChild(label);
-shouldBe('labels.length', '1');
-
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-label.htmlFor = "id3";
-document.getElementById("div1").appendChild(label);
-shouldBe('labels.length', '1');
-
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-label.htmlFor = "id4";
-document.getElementById("div1").appendChild(label);
-shouldBe('labels.length', '1');
diff --git a/LayoutTests/fast/forms/script-tests/labels-add-parent-label.js b/LayoutTests/fast/forms/script-tests/labels-add-parent-label.js
deleted file mode 100644
index 6d9c59e..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-add-parent-label.js
+++ /dev/null
@@ -1,36 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when adding a label as parent for that form control. ');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
-
-document.body.appendChild(parent);
-
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-document.getElementById("div1").appendChild(label);
-label.appendChild(document.getElementById("id1"));
-shouldBe('labels.length', '1');
-
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-document.getElementById("div1").appendChild(label);
-label.appendChild(document.getElementById("id2"));
-shouldBe('labels.length', '1');
-
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-document.getElementById("div1").appendChild(label);
-label.appendChild(document.getElementById("id3"));
-shouldBe('labels.length', '1');
-
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '0');
-label = document.createElement("label");
-document.getElementById("div1").appendChild(label);
-label.appendChild(document.getElementById("id4"));
-shouldBe('labels.length', '1');
-
diff --git a/LayoutTests/fast/forms/script-tests/labels-change-htmlFor-attribute.js b/LayoutTests/fast/forms/script-tests/labels-change-htmlFor-attribute.js
deleted file mode 100644
index 42fd74e..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-change-htmlFor-attribute.js
+++ /dev/null
@@ -1,32 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label changes to point to that control. ');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><label id="labelId"></label><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
-
-document.body.appendChild(parent);
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '0');
-label.htmlFor = "id1";
-shouldBe('labels.length', '1');
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '0');
-label.htmlFor = "id2";
-shouldBe('labels.length', '1');
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '0');
-label.htmlFor = "id3";
-shouldBe('labels.length', '1');
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '0');
-label.htmlFor = "id4";
-shouldBe('labels.length', '1');
-
diff --git a/LayoutTests/fast/forms/script-tests/labels-item-index.js b/LayoutTests/fast/forms/script-tests/labels-item-index.js
deleted file mode 100644
index a85ede4..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-item-index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-description('Test that the items of a labels list can be accessed individually. ');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div><label id="l1" for="id1"></label><label id="l2" for="id2"></label><label id="l3" for="id3"></label><label id="l4" for="id4"></label><label id="l11" for="id1"></label><label id="l12" for="id2"></label><label id="l13" for="id3"></label><label id="l14" for="id4"></label>';
-
-document.body.appendChild(parent);
-
-labels = document.getElementById("id1").labels;
-shouldBe('labels.item(1).id', '"l11"');
-
-labels = document.getElementById("id2").labels;
-shouldBe('labels.item(1).id', '"l12"');
-
-labels = document.getElementById("id3").labels;
-shouldBe('labels.item(1).id', '"l13"');
-
-labels = document.getElementById("id4").labels;
-shouldBe('labels.item(1).id', '"l14"');
diff --git a/LayoutTests/fast/forms/script-tests/labels-remove-htmlFor-attribute.js b/LayoutTests/fast/forms/script-tests/labels-remove-htmlFor-attribute.js
deleted file mode 100644
index 8549217..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-remove-htmlFor-attribute.js
+++ /dev/null
@@ -1,32 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label is removed.');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><label id="label1" for="id1"></label><label id="label2" for="id2"></label><label id="label3" for="id3"></label><label id="label4" for="id4"></label><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
-
-document.body.appendChild(parent);
-
-label = document.getElementById("label1");
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '1');
-label.removeAttribute("for");
-shouldBe('labels.length', '0');
-
-label = document.getElementById("label2");
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '1');
-label.removeAttribute("for");
-shouldBe('labels.length', '0');
-
-label = document.getElementById("label3");
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '1');
-label.removeAttribute("for");
-shouldBe('labels.length', '0');
-
-label = document.getElementById("label4");
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '1');
-label.removeAttribute("for");
-shouldBe('labels.length', '0');
-
diff --git a/LayoutTests/fast/forms/script-tests/labels-remove-htmlFor-label.js b/LayoutTests/fast/forms/script-tests/labels-remove-htmlFor-label.js
deleted file mode 100644
index 2eece7c..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-remove-htmlFor-label.js
+++ /dev/null
@@ -1,27 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when removing the htmlFor attribute that pointed to that form control.');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div><label id="l1" for="id1"></label><label id="l2" for="id2"></label><label id="l3" for="id3"></label><label id="l4" for="id4"></label>';
-
-document.body.appendChild(parent);
-
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '1');
-document.getElementById("l1").htmlFor = "";
-shouldBe('labels.length', '0');
-
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '1');
-document.getElementById("l2").htmlFor = "";
-shouldBe('labels.length', '0');
-
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '1');
-document.getElementById("l3").htmlFor = "";
-shouldBe('labels.length', '0');
-
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '1');
-document.getElementById("l4").htmlFor = "";
-shouldBe('labels.length', '0');
diff --git a/LayoutTests/fast/forms/script-tests/labels-remove-parent-label.js b/LayoutTests/fast/forms/script-tests/labels-remove-parent-label.js
deleted file mode 100644
index 4c815cd..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-remove-parent-label.js
+++ /dev/null
@@ -1,28 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when removing a label as parent for that form control. ');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><label><button id="id1"></button></label><label><input id="id2"></label><label><select id="id3"></select></label><label><textarea id="id4"></textarea></label></div>';
-
-
-document.body.appendChild(parent);
-
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '1');
-document.getElementById("div1").appendChild(document.getElementById("id1"));
-shouldBe('labels.length', '0');
-
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '1');
-document.getElementById("div1").appendChild(document.getElementById("id2"));
-shouldBe('labels.length', '0');
-
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '1');
-document.getElementById("div1").appendChild(document.getElementById("id3"));
-shouldBe('labels.length', '0');
-
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '1');
-document.getElementById("div1").appendChild(document.getElementById("id4"));
-shouldBe('labels.length', '0');
diff --git a/LayoutTests/fast/forms/script-tests/labels-set-htmlFor-attribute.js b/LayoutTests/fast/forms/script-tests/labels-set-htmlFor-attribute.js
deleted file mode 100644
index 841eef9..0000000
--- a/LayoutTests/fast/forms/script-tests/labels-set-htmlFor-attribute.js
+++ /dev/null
@@ -1,32 +0,0 @@
-description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label changes to point to that control. ');
-
-var parent = document.createElement('div');
-
-parent.innerHTML = '<div id="div1"></div><div id="div2"><label id="labelId"></label><button id="id1"></button><input id="id2"><select id="id3"></select><textarea id="id4"></textarea></div>';
-
-document.body.appendChild(parent);
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id1").labels;
-shouldBe('labels.length', '0');
-label.setAttribute("for", "id1");
-shouldBe('labels.length', '1');
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id2").labels;
-shouldBe('labels.length', '0');
-label.setAttribute("for", "id2");
-shouldBe('labels.length', '1');
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id3").labels;
-shouldBe('labels.length', '0');
-label.setAttribute("for", "id3");
-shouldBe('labels.length', '1');
-
-label = document.getElementById("labelId");
-labels = document.getElementById("id4").labels;
-shouldBe('labels.length', '0');
-label.setAttribute("for", "id4");
-shouldBe('labels.length', '1');
-
diff --git a/LayoutTests/fast/forms/script-tests/listbox-deselect-scroll.js b/LayoutTests/fast/forms/script-tests/listbox-deselect-scroll.js
deleted file mode 100644
index 85e9066..0000000
--- a/LayoutTests/fast/forms/script-tests/listbox-deselect-scroll.js
+++ /dev/null
@@ -1,45 +0,0 @@
-description('This tests that deselecting an option won't cause unnecessary scrolling.');
-
-function mouseDownOnSelect(selId, index, modifier) {
- var sl = document.getElementById(selId);
- var itemHeight = Math.floor(sl.offsetHeight / sl.size);
- var border = 1;
- var y = border + index * itemHeight - window.pageYOffset;
- if (window.eventSender) {
- eventSender.mouseMoveTo(sl.offsetLeft + border, sl.offsetTop + y);
- eventSender.mouseDown(0, [modifier]);
- eventSender.mouseUp(0, [modifier]);
- }
-}
-
-function selectionPattern(select) {
- var result = '';
- for (var i = 0; i < select.options.length; i++)
- result += select.options[i].selected ? '1' : '0';
- return result;
-}
-
-var parent = document.createElement('div');
-parent.innerHTML = '<select id="sl" multiple="multiple" size="5">'
- + '<option value="Accessibility">Accessibility</option>'
- + '<option value="CSS">CSS</option>'
- + '<option value="Drosera">Drosera</option>'
- + '<option value="Evangelism">Evangelism</option>'
- + '<option value="Forms">Forms</option>'
- + '<option value="Frames">Frames</option>'
- + '<option value="History">History</option>'
- + '<option value="HTML DOM">HTML DOM</option>'
- + '<option value="HTML Editing">HTML Editing</option>'
- + '<option value="Images">Images</option>'
- + '<option>SCROLL UP</option>'
- + '</select>';
-document.body.appendChild(parent);
-
-var sl = document.getElementById('sl');
-sl.focus();
-document.execCommand("SelectAll");
-sl.scrollTop = Math.floor(sl.offsetHeight / sl.size) * 4 + 6;
-var scrollBeforeClick = sl.scrollTop;
-mouseDownOnSelect("sl", 3, "addSelectionKey");
-shouldBe('sl.scrollTop', 'scrollBeforeClick');
-shouldBe('selectionPattern(sl)', '"11111110111"');
diff --git a/LayoutTests/fast/forms/script-tests/listbox-selection-2.js b/LayoutTests/fast/forms/script-tests/listbox-selection-2.js
deleted file mode 100644
index 4c04426..0000000
--- a/LayoutTests/fast/forms/script-tests/listbox-selection-2.js
+++ /dev/null
@@ -1,87 +0,0 @@
-description('<select> selection test for scrolling.');
-
-var parent = document.createElement('div');
-parent.innerHTML = '<select id="sl1" multiple size=5>'
- + '<option>one</option>'
- + '<option>two</option>'
- + '<option>three</option>'
- + '<option>four</option>'
- + '<option>five</option>'
- + '<option>six</option>'
- + '<option>seven</option>'
- + '<option>eight</option>'
- + '<option>nine</option>'
- + '<option>ten</option>'
- + '<option>eleven</option>'
- + '<option>twelve</option>'
- + '<option>thirteen</option>'
- + '<option>fourteen</option>'
- + '<option>fifteen</option>'
- + '<option>sixteen</option>'
- + '<option>seventeen</option>'
- + '</select>'
- + '<select id="sl2" multiple style="height: 135px; border: 10px solid; padding: 5px;">'
- + '<option>one</option>'
- + '<option>two</option>'
- + '<option>three</option>'
- + '</select>';
-document.body.appendChild(parent);
-
-// Determine the item height.
-var sl1 = document.getElementById('sl1');
-var sl2 = document.getElementById('sl2');
-var itemHeight = Math.floor(sl1.offsetHeight / sl1.size);
-sl1.removeAttribute('size');
-var height = itemHeight * 9 + 9;
-sl1.setAttribute('style', 'height: ' + height + 'px; border: 10px solid; padding: 5px;');
-
-function mouseDownOnSelect(selId, index)
-{
- var sl = document.getElementById(selId);
- var borderPaddingTop = 15;
- var borderPaddingLeft = 15;
- var y = index * itemHeight + itemHeight / 3 - window.pageYOffset + borderPaddingTop;
- var event = document.createEvent("MouseEvent");
- event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y, sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y, false, false, false, false, 0, document);
- sl.dispatchEvent(event);
-}
-
-function selectionPattern(selectId)
-{
- var select = document.getElementById(selectId);
- var result = "";
- for (var i = 0; i < select.options.length; i++)
- result += select.options[i].selected ? '1' : '0';
- return result;
-}
-
-mouseDownOnSelect("sl1", 0);
-shouldBe('selectionPattern("sl1")', '"10000000000000000"');
-
-mouseDownOnSelect("sl1", 1);
-shouldBe('selectionPattern("sl1")', '"01000000000000000"');
-
-mouseDownOnSelect("sl1", 6);
-shouldBe('selectionPattern("sl1")', '"00000010000000000"');
-
-mouseDownOnSelect("sl1", 7);
-shouldBe('selectionPattern("sl1")', '"00000001000000000"');
-
-mouseDownOnSelect("sl1", 8);
-shouldBe('selectionPattern("sl1")', '"00000001000000000"');
-
-mouseDownOnSelect("sl1", 0);
-shouldBe('selectionPattern("sl1")', '"01000000000000000"');
-
-for (i = 0; i < 9; i++)
- mouseDownOnSelect("sl1", 7);
-shouldBe('selectionPattern("sl1")', '"00000000000000001"');
-
-mouseDownOnSelect("sl2", 1);
-shouldBe('selectionPattern("sl2")', '"010"');
-
-mouseDownOnSelect("sl2", 3);
-shouldBe('selectionPattern("sl2")', '"010"');
-
-mouseDownOnSelect("sl2", 2);
-shouldBe('selectionPattern("sl2")', '"001"');
diff --git a/LayoutTests/fast/forms/script-tests/listbox-selection.js b/LayoutTests/fast/forms/script-tests/listbox-selection.js
deleted file mode 100644
index 66c1eae..0000000
--- a/LayoutTests/fast/forms/script-tests/listbox-selection.js
+++ /dev/null
@@ -1,125 +0,0 @@
-description('<select> selection test for mouse events and keyevents.');
-
-function mouseDownOnSelect(selId, index, modifier) {
- var sl = document.getElementById(selId);
- var itemHeight = Math.floor(sl.offsetHeight / sl.size);
- var border = 1;
- var y = border + index * itemHeight;
-
- sl.focus();
- if (window.eventSender) {
- eventSender.mouseMoveTo(sl.offsetLeft + border, sl.offsetTop + y - window.pageYOffset);
- eventSender.mouseDown(0, [modifier]);
- eventSender.mouseUp(0, [modifier]);
- }
-}
-
-function keyDownOnSelect(selId, identifier, modifier) {
- document.getElementById(selId).focus();
- if (window.eventSender)
- eventSender.keyDown(identifier, [modifier]);
-}
-
-function createSelect(idName, sz, mlt, selIndex) {
- var sl = document.createElement("select");
- var i = 0;
- sl.size = sz;
- while (i < sz) {
- var opt = document.createElement("option");
- if (i == selIndex)
- opt.selected = true;
- opt.textContent = "item " + i;
- sl.appendChild(opt);
- i++;
- }
- sl.multiple = mlt;
- sl.id = idName;
- var parent = document.getElementById("parent");
- parent.appendChild(sl);
-}
-
-function selectionPattern(selId) {
- var sl = document.getElementById(selId);
- var result = '';
- for (var i = 0; i < sl.options.length; i++)
- result += sl.options[i].selected ? '1' : '0';
- return result;
-}
-
-var parent = document.createElement('div');
-parent.id = "parent";
-document.body.appendChild(parent);
-
-createSelect("sl1", 5, false, -1);
-createSelect("sl2", 5, false, 1);
-createSelect("sl3", 5, false, -1);
-createSelect("sl4", 5, false, 1);
-createSelect("sl5", 5, false, 2);
-createSelect("sl6", 5, false, 3);
-createSelect("sl7", 5, false, 1);
-
-createSelect("sl8", 5, true, -1);
-createSelect("sl9", 5, true, 1);
-createSelect("sl10", 5, true, -1);
-createSelect("sl11", 5, true, 1);
-createSelect("sl12", 5, true, 2);
-createSelect("sl13", 5, true, 0);
-createSelect("sl14", 5, true, 1);
-
-debug("1) Select one item with mouse (no previous selection)");
-mouseDownOnSelect("sl1", 0);
-shouldBe('selectionPattern("sl1")', '"10000"');
-
-debug("2) Select one item with mouse (with previous selection)");
-mouseDownOnSelect("sl2", 0);
-shouldBe('selectionPattern("sl2")', '"10000"');
-
-debug("3) Select one item with the keyboard (no previous selection)");
-keyDownOnSelect("sl3", "upArrow");
-shouldBe('selectionPattern("sl3")', '"00001"');
-
-debug("4) Select one item with the keyboard (with previous selection)");
-keyDownOnSelect("sl4", "downArrow");
-shouldBe('selectionPattern("sl4")', '"00100"');
-
-debug("5) Attempt to select an item cmd-clicking");
-mouseDownOnSelect("sl5", 1, "addSelectionKey");
-shouldBe('selectionPattern("sl5")', '"01000"');
-
-debug("6) Attempt to select a range shift-clicking");
-mouseDownOnSelect("sl6", 1, "rangeSelectionKey");
-shouldBe('selectionPattern("sl6")', '"01000"');
-
-debug("7) Attempt to select a range with the keyboard");
-keyDownOnSelect("sl7", "downArrow", "rangeSelectionKey");
-shouldBe('selectionPattern("sl7")', '"00100"');
-
-// Multiple selection tests
-
-debug("8) Select one item with mouse (no previous selection)");
-mouseDownOnSelect("sl8", 0);
-shouldBe('selectionPattern("sl8")', '"10000"');
-
-debug("9) Select one item with mouse (with previous selection)");
-mouseDownOnSelect("sl9", 0);
-shouldBe('selectionPattern("sl9")', '"10000"');
-
-debug("10) Select one item with the keyboard (no previous selection)");
-keyDownOnSelect("sl10", "upArrow");
-shouldBe('selectionPattern("sl10")', '"00001"');
-
-debug("11) Select one item with the keyboard (with previous selection)");
-keyDownOnSelect("sl11", "downArrow");
-shouldBe('selectionPattern("sl11")', '"00100"');
-
-debug("12) Select an item cmd-clicking");
-mouseDownOnSelect("sl12", 1, "addSelectionKey");
-shouldBe('selectionPattern("sl12")', '"01100"');
-
-debug("13) Select a range shift-clicking");
-mouseDownOnSelect("sl13", 3, "rangeSelectionKey");
-shouldBe('selectionPattern("sl13")', '"11110"');
-
-debug("14) Select a range with the keyboard");
-keyDownOnSelect("sl14", "downArrow", "rangeSelectionKey");
-shouldBe('selectionPattern("sl14")', '"01100"');
diff --git a/LayoutTests/fast/forms/script-tests/menulist-disabled-selected-option.js b/LayoutTests/fast/forms/script-tests/menulist-disabled-selected-option.js
deleted file mode 100644
index 80c0f87..0000000
--- a/LayoutTests/fast/forms/script-tests/menulist-disabled-selected-option.js
+++ /dev/null
@@ -1,25 +0,0 @@
-description('Check that a select control does not produce a form value if the selected option element is disabled.');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-parent.innerHTML = '<form action="">'
- + '<input type=hidden name="submitted" value="true">'
- + '<select name="select">'
- + '<option disabled>Disabled</option>'
- + '<option>Enabled</option>'
- + '</select>'
- + '</form>';
-
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-var query = window.location.search;
-if (query.indexOf('submitted=true') == -1) {
- var select = document.getElementsByTagName('select')[0];
- select.selectedIndex = 0;
- document.forms[0].submit();
-} else {
- shouldBe('query.indexOf("select=Disabled")', '-1');
- shouldBe('query.indexOf("select=Enabled")', '-1');
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
diff --git a/LayoutTests/fast/forms/script-tests/menulist-submit-without-selection.js b/LayoutTests/fast/forms/script-tests/menulist-submit-without-selection.js
deleted file mode 100644
index 28dc59a..0000000
--- a/LayoutTests/fast/forms/script-tests/menulist-submit-without-selection.js
+++ /dev/null
@@ -1,23 +0,0 @@
-description('A unselected option was submitted as fallback. This behavior was removed by the change of webkit.org/b/35056.');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-parent.innerHTML = '<form action="">'
- + '<input type=hidden name="submitted" value="true">'
- + '<select name="select">'
- + '<option disabled>Disabled</option>'
- + '</select>'
- + '</form>';
-
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-var query = window.location.search;
-if (query.indexOf('submitted=true') == -1) {
- var select = document.getElementsByTagName('select')[0];
- select.selectedIndex = 0;
- document.forms[0].submit();
-} else {
- shouldBe('query.indexOf("select=Disabled")', '-1');
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
diff --git a/LayoutTests/fast/forms/script-tests/novalidate-attribute.js b/LayoutTests/fast/forms/script-tests/novalidate-attribute.js
deleted file mode 100644
index 6c8d8c0..0000000
--- a/LayoutTests/fast/forms/script-tests/novalidate-attribute.js
+++ /dev/null
@@ -1,34 +0,0 @@
-description("This test performs some simple check on the noValidate attribute.");
-
-var f = document.createElement("form");
-
-shouldBe("f.hasAttribute('noValidate')", "false");
-shouldBe("f.getAttribute('noValidate')", "null");
-shouldBe("f.noValidate", "false");
-
-f.noValidate = true;
-
-shouldBe("f.hasAttribute('noValidate')", "true");
-shouldBe("f.getAttribute('noValidate')", "''");
-shouldBe("f.noValidate", "true");
-
-var f2 = document.createElement("form");
-f2.noValidate = f.noValidate;
-
-f.noValidate = false;
-
-shouldBe("f.hasAttribute('noValidate')", "false");
-shouldBe("f.getAttribute('noValidate')", "null");
-shouldBe("f.noValidate", "false");
-
-shouldBe("f2.hasAttribute('noValidate')", "true");
-shouldBe("f2.getAttribute('noValidate')", "''");
-shouldBe("f2.noValidate", "true");
-
-f2.noValidate = false;
-
-shouldBe("f2.noValidate", "false");
-f2.noValidate = "something";
-shouldBe("f2.hasAttribute('noValidate')", "true");
-shouldBe("f2.getAttribute('noValidate')", "''");
-shouldBe("f2.noValidate", "true");
diff --git a/LayoutTests/fast/forms/script-tests/output-reset-assertion-failed.js b/LayoutTests/fast/forms/script-tests/output-reset-assertion-failed.js
deleted file mode 100644
index 65fc582..0000000
--- a/LayoutTests/fast/forms/script-tests/output-reset-assertion-failed.js
+++ /dev/null
@@ -1,42 +0,0 @@
-description('Ensures that assertion failures don\'t occur on updating the value of <output> elements.');
-
-debug('- A test in the value is set twice.');
-var output = document.createElement('output');
-document.body.appendChild(output);
-output.value = '';
-output.value = '';
-testPassed('Not crashed');
-document.body.removeChild(output);
-
-debug('');
-debug('- A test in the value is set to different values twice.');
-output = document.createElement('output');
-document.body.appendChild(output);
-output.value = '';
-output.value = 'foo';
-testPassed('Not crashed');
-document.body.removeChild(output);
-
-debug('');
-debug('- A test in reset events occur twice when there is no default value.');
-var form = document.createElement('form');
-document.body.appendChild(form);
-output = document.createElement('output');
-form.appendChild(output);
-form.reset();
-form.reset();
-testPassed('Not crashed');
-document.body.removeChild(form);
-
-debug('');
-debug('- A test in reset events occur twice when the value is the same as the default value.');
-form = document.createElement('form');
-document.body.appendChild(form);
-output = document.createElement('output');
-output.defaultValue = 'foo';
-output.value = 'foo';
-form.appendChild(output);
-form.reset();
-form.reset();
-testPassed('Not crashed');
-document.body.removeChild(form);
diff --git a/LayoutTests/fast/forms/script-tests/placeholder-dom-property.js b/LayoutTests/fast/forms/script-tests/placeholder-dom-property.js
deleted file mode 100644
index 7268afa..0000000
--- a/LayoutTests/fast/forms/script-tests/placeholder-dom-property.js
+++ /dev/null
@@ -1,12 +0,0 @@
-description("Test for <a href='https://bugs.webkit.org/show_bug.cgi?id=21903'>https://bugs.webkit.org/show_bug.cgi?id=21903</a>");
-
-var input = document.createElement("input");
-
-shouldBeEqualToString("input.placeholder", '');
-
-input.setAttribute("placeholder", "p1")
-shouldBeEqualToString("input.placeholder", 'p1');
-
-input.placeholder = 'p2';
-shouldBeEqualToString("input.getAttribute('placeholder')", 'p2');
-shouldBeEqualToString("input.placeholder", 'p2');
diff --git a/LayoutTests/fast/forms/script-tests/search-cancel-button-events.js b/LayoutTests/fast/forms/script-tests/search-cancel-button-events.js
deleted file mode 100644
index 59ce128..0000000
--- a/LayoutTests/fast/forms/script-tests/search-cancel-button-events.js
+++ /dev/null
@@ -1,35 +0,0 @@
-description('Test for event dipatching by search cancel button.');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-parent.innerHTML = '<input type=search id=search value=foo><input id=another>';
-var search = document.getElementById('search');
-var anotherInput = document.getElementById('another');
-var inputEventCounter = 0;
-var changeEventCounter = 0;
-
-search.onchange = function() { changeEventCounter++; };
-search.oninput = function() { inputEventCounter++; };
-
-if (window.eventSender) {
- debug('Initial state');
- shouldBe('changeEventCounter', '0');
- shouldBe('inputEventCounter', '0');
-
- debug('Click the cancel button');
- eventSender.mouseMoveTo(search.offsetLeft + search.offsetWidth - 8, search.offsetTop + search.offsetHeight / 2);
- eventSender.mouseDown();
- eventSender.mouseUp();
- shouldBe('search.value', '""');
- shouldBe('changeEventCounter', '0');
- shouldBe('inputEventCounter', '1');
-
- debug('Focus on another field');
- anotherInput.focus();
- shouldBe('changeEventCounter', '1');
- shouldBe('inputEventCounter', '1');
-
- parent.innerHTML = '';
-} else {
- document.getElementById('console').innerHTML = 'No eventSender';
-}
diff --git a/LayoutTests/fast/forms/script-tests/select-set-length-optgroup.js b/LayoutTests/fast/forms/script-tests/select-set-length-optgroup.js
deleted file mode 100644
index 03b68cd..0000000
--- a/LayoutTests/fast/forms/script-tests/select-set-length-optgroup.js
+++ /dev/null
@@ -1,28 +0,0 @@
-description('This test that setting HTMLSelectElement.length respects optgroups.');
-
-var wrapper = document.createElement('div');
-document.body.appendChild(wrapper);
-wrapper.innerHTML = '<select id="theSelect">'+
- '<optgroup label="foo" id="theOptGroup">'+
- '<option id="optionInGroup"></option>'+
- '</optgroup>'+
- '</select>';
-
-var sel = document.getElementById('theSelect');
-shouldBe('sel.length', '1');
-
-var og = document.getElementById('theOptGroup');
-
-sel.length = 2;
-shouldBe('sel.length', '2');
-shouldBe('og.childElementCount', '1');
-
-sel.length = 1;
-shouldBe('sel.length', '1');
-shouldBe('og.childElementCount', '1');
-
-sel.insertBefore(document.createElement('option'), og);
-
-sel.length = 1;
-shouldBe('sel.length', '1');
-shouldBe('og.childElementCount', '0');
diff --git a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-remove.js b/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-remove.js
deleted file mode 100644
index 0bb3e29..0000000
--- a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-remove.js
+++ /dev/null
@@ -1,35 +0,0 @@
-description('Tests that setting .length on an HTMLSelectElement works in the presence of mutation listeners that remove option elements.');
-
-function gc() {
- if (window.GCController)
- return GCController.collect();
-
- for (var i=0; i<10000; ++i) {
- var s = new String("abc");
- }
-}
-
-function onRemove(e) {
- if (e.target.nextSibling != null) {
- // remove listener temporarily to avoid lots of nesting
- sel.removeEventListener('DOMNodeRemoved', onRemove, false);
- e.target.nextSibling.parentNode.removeChild(e.target.nextSibling);
- sel.addEventListener('DOMNodeRemoved', onRemove, false);
- }
- gc();
-}
-
-var sel = document.createElement('select');
-document.body.appendChild(sel);
-
-sel.addEventListener('DOMNodeRemoved', onRemove, false);
-sel.addEventListener('DOMNodeInserted', function() {}, false);
-
-sel.length = 200;
-shouldBe('sel.length', '200');
-
-sel.length = 100;
-shouldBe('sel.length', '100');
-
-sel.length = 180;
-shouldBe('sel.length', '180');
diff --git a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-reorder.js b/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-reorder.js
deleted file mode 100644
index 40ecd60..0000000
--- a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-reorder.js
+++ /dev/null
@@ -1,34 +0,0 @@
-description('Tests that setting the .length on an HTMLSelectElement works in the presence of DOM mutation listeners that reorder option elements');
-
-var wrapper = document.createElement('div');
-document.body.appendChild(wrapper);
-wrapper.innerHTML = '<select id="theSelect">' +
- '<option id="a">a</option>' +
- '<option id="b">b</option>' +
- '<option id="c">c</option>' +
- '<option id="d">d</option>' +
- '</select>';
-
-var sel = document.getElementById('theSelect');
-
-var firstRemove = true;
-function onRemove(e) {
- if (firstRemove) {
- // remove listener temporarily to avoid lots of nesting
- sel.removeEventListener('DOMNodeRemoved', onRemove, false);
- var lastOption = document.getElementById('d');
- sel.removeChild(lastOption);
- sel.insertBefore(lastOption, document.getElementById('c'));
- firstRemove = false;
- sel.addEventListener('DOMNodeRemoved', onRemove, false);
- }
-}
-
-sel.addEventListener('DOMNodeRemoved', onRemove, false);
-sel.addEventListener('DOMNodeInserted', function() {}, false);
-
-shouldBe('sel.length', '4');
-sel.length = 2;
-shouldBe('sel.length', '2');
-shouldBe('sel.options.item(0).id', '"a"');
-shouldBe('sel.options.item(1).id', '"b"');
diff --git a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-reparent.js b/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-reparent.js
deleted file mode 100644
index eb1e027..0000000
--- a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation-reparent.js
+++ /dev/null
@@ -1,32 +0,0 @@
-description('Tests that setting .length on an HTMLSelectElement works in the presence of mutation event listeners that reparent options');
-
-var sel = document.createElement('select');
-document.body.appendChild(sel);
-var otherSel = document.createElement('select');
-document.body.appendChild(otherSel);
-
-function onRemove(e) {
- if (e.target.nextSibling != null) {
- // remove listener temporarily to avoid lots of nesting
- sel.removeEventListener('DOMNodeRemoved', onRemove, false);
- var n = e.target.nextSibling;
- n.parentNode.removeChild(n);
- otherSel.appendChild(n);
- sel.addEventListener('DOMNodeRemoved', onRemove, false);
- }
-}
-
-sel.addEventListener('DOMNodeRemoved', onRemove, false);
-sel.addEventListener('DOMNodeInserted', function() {}, false);
-
-sel.length = 200;
-shouldBe('sel.length', '200');
-shouldBe('otherSel.length', '0');
-
-sel.length = 100;
-shouldBe('sel.length', '100');
-shouldBe('otherSel.length', '0');
-
-sel.length = 180;
-shouldBe('sel.length', '180');
-shouldBe('otherSel.length', '0');
diff --git a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation.js b/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation.js
deleted file mode 100644
index 72505ed..0000000
--- a/LayoutTests/fast/forms/script-tests/select-set-length-with-mutation.js
+++ /dev/null
@@ -1,16 +0,0 @@
-description('Tests setting the .length of an HTMLSelectElement with mutation listeners registered.');
-
-var sel = document.createElement('select');
-document.body.appendChild(sel);
-
-sel.addEventListener('DOMNodeRemoved', function() {}, false);
-sel.addEventListener('DOMNodeInserted', function() {}, false);
-
-sel.length = 200;
-shouldBe('sel.length', '200');
-
-sel.length = 100;
-shouldBe('sel.length', '100');
-
-sel.length = 180;
-shouldBe('sel.length', '180');
diff --git a/LayoutTests/fast/forms/script-tests/select-set-length.js b/LayoutTests/fast/forms/script-tests/select-set-length.js
deleted file mode 100644
index 577d902..0000000
--- a/LayoutTests/fast/forms/script-tests/select-set-length.js
+++ /dev/null
@@ -1,15 +0,0 @@
-description('Tests that setting the .length of an HTMLSelectElement correctly creates and destroys options.');
-
-var sel = document.createElement('select');
-document.body.appendChild(sel);
-
-shouldBe('sel.length', '0');
-
-sel.length = 200;
-shouldBe('sel.length', '200');
-
-sel.length = 100;
-shouldBe('sel.length', '100');
-
-sel.length = 180;
-shouldBe('sel.length', '180');
diff --git a/LayoutTests/fast/forms/script-tests/setCustomValidity-existence.js b/LayoutTests/fast/forms/script-tests/setCustomValidity-existence.js
deleted file mode 100644
index d58e20e..0000000
--- a/LayoutTests/fast/forms/script-tests/setCustomValidity-existence.js
+++ /dev/null
@@ -1,25 +0,0 @@
-description('Existence tests for .setCustomValidity property');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-
-debug('Existence of .setCustomValidity');
-parent.innerHTML = '<form>'
- + '<input name="victim"/>'
- + '<textarea name="victim"></textarea>'
- + '<fieldset name="victim">Test</fieldset>'
- + '<button name="victim">'
- + '<select name="victim"></select>'
- + '<output name="victim"></output>'
- + '<object name="victim"></object>'
- + '<keygen name="victim">'
- + '</form>';
-
-shouldBe('typeof document.getElementsByTagName("input")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("button")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("fieldset")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("select")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("textarea")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("output")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("object")[0].setCustomValidity', '"function"');
-shouldBe('typeof document.getElementsByTagName("keygen")[0].setCustomValidity', '"function"');
diff --git a/LayoutTests/fast/forms/script-tests/shadow-tree-exposure.js b/LayoutTests/fast/forms/script-tests/shadow-tree-exposure.js
deleted file mode 100644
index 933b466..0000000
--- a/LayoutTests/fast/forms/script-tests/shadow-tree-exposure.js
+++ /dev/null
@@ -1,73 +0,0 @@
-description("Test to make sure shadow nodes are not exposed.");
-
-var container = document.createElement("p");
-document.body.appendChild(container);
-
-container.appendChild(document.createTextNode("Some text: "));
-
-shouldBe("getSelection().anchorNode", "null");
-shouldBe("getSelection().anchorOffset", "0");
-shouldBe("getSelection().focusNode", "null");
-shouldBe("getSelection().focusOffset", "0");
-shouldBe("getSelection().isCollapsed", "true");
-shouldBe("getSelection().rangeCount", "0");
-
-shouldBe("getSelection().baseNode", "null");
-shouldBe("getSelection().baseOffset", "0");
-shouldBe("getSelection().extentNode", "null");
-shouldBe("getSelection().extentOffset", "0");
-shouldBe("getSelection().type", "'None'");
-
-debug("\nAdd an input element.\n");
-
-var input = document.createElement("input");
-container.appendChild(input);
-input.value = "text";
-input.focus();
-input.select();
-
-shouldBe("getSelection().anchorNode", "container");
-shouldBe("getSelection().anchorOffset", "1");
-shouldBe("getSelection().focusNode", "container");
-shouldBe("getSelection().focusOffset", "1");
-shouldBe("getSelection().isCollapsed", "true");
-shouldBe("getSelection().rangeCount", "1");
-shouldBe("getSelection().getRangeAt(0).startContainer", "container");
-shouldBe("getSelection().getRangeAt(0).startOffset", "1");
-shouldBe("getSelection().getRangeAt(0).endContainer", "container");
-shouldBe("getSelection().getRangeAt(0).endOffset", "1");
-
-shouldBe("getSelection().baseNode", "container");
-shouldBe("getSelection().baseOffset", "1");
-shouldBe("getSelection().extentNode", "container");
-shouldBe("getSelection().extentOffset", "1");
-shouldBe("getSelection().type", "'Range'");
-
-debug("\nAdd a textarea element.\n");
-
-var textarea = document.createElement("textarea");
-container.appendChild(textarea);
-textarea.value = "text";
-textarea.focus();
-textarea.select();
-
-shouldBe("getSelection().anchorNode", "container");
-shouldBe("getSelection().anchorOffset", "2");
-shouldBe("getSelection().focusNode", "container");
-shouldBe("getSelection().focusOffset", "2");
-shouldBe("getSelection().isCollapsed", "true");
-shouldBe("getSelection().rangeCount", "1");
-shouldBe("getSelection().getRangeAt(0).startContainer", "container");
-shouldBe("getSelection().getRangeAt(0).startOffset", "2");
-shouldBe("getSelection().getRangeAt(0).endContainer", "container");
-shouldBe("getSelection().getRangeAt(0).endOffset", "2");
-
-shouldBe("getSelection().baseNode", "container");
-shouldBe("getSelection().baseOffset", "2");
-shouldBe("getSelection().extentNode", "container");
-shouldBe("getSelection().extentOffset", "2");
-shouldBe("getSelection().type", "'Range'");
-
-document.body.removeChild(container);
-
-debug("");
diff --git a/LayoutTests/fast/forms/script-tests/submit-form-attributes.js b/LayoutTests/fast/forms/script-tests/submit-form-attributes.js
deleted file mode 100644
index cdf81c9..0000000
--- a/LayoutTests/fast/forms/script-tests/submit-form-attributes.js
+++ /dev/null
@@ -1,195 +0,0 @@
-description('Tests the behavior of .formaction, .formenctype, .formmethod and .formtarget of HTMLInputElement and HTMLButtonElement.');
-
-var input = document.createElement('input');
-
-debug('Ordinary values for input:');
-input.type = "submit";
-shouldBe('input.formAction', '""');
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('input.formMethod', '"get"');
-shouldBe('input.formTarget', '""');
-
-input.setAttribute('formAction', 'http://localhost');
-shouldBe('input.formAction', '"http://localhost/"');
-input.setAttribute('formAction', 'http://localhost/');
-shouldBe('input.formAction', '"http://localhost/"');
-input.setAttribute('formEnctype', 'text/plain');
-shouldBe('input.formEnctype', '"text/plain"');
-input.setAttribute('formEnctype', 'na');
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-input.setAttribute('formMethod', 'GET');
-shouldBe('input.formMethod', '"get"');
-input.setAttribute('formMethod', 'ni');
-shouldBe('input.formMethod', '"get"');
-input.setAttribute('formTarget', '_blank');
-shouldBe('input.formTarget', '"_blank"');
-input.setAttribute('formTarget', 'nu');
-shouldBe('input.formTarget', '"nu"');
-
-input.formAction = 'http://example.com';
-shouldBe('input.formAction', '"http://example.com/"');
-input.formAction = 'http://example.com/';
-shouldBe('input.formAction', '"http://example.com/"');
-input.formEnctype = 'text/plain';
-shouldBe('input.formEnctype', '"text/plain"');
-input.formEnctype = 'nota';
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-input.formMethod = 'POST';
-shouldBe('input.formMethod', '"post"');
-input.formMethod = 'neta';
-shouldBe('input.formMethod', '"get"');
-input.formTarget = 'http://example.com';
-shouldBe('input.formTarget', '"http://example.com"');
-input.formTarget = 'nta';
-shouldBe('input.formTarget', '"nta"');
-
-debug('');
-debug('Setting null for input:');
-input.formEnctype = null;
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('input.getAttribute("formEnctype")', 'null');
-input.setAttribute('formEnctype', null);
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-input.formMethod = null;
-shouldBe('input.formMethod', '"get"');
-shouldBe('input.getAttribute("formMethod")', 'null');
-input.setAttribute('formMethod', null);
-shouldBe('input.formMethod', '"get"');
-input.formTarget = null;
-shouldBe('input.formTarget', '""');
-shouldBe('input.getAttribute("formTarget")', 'null');
-input.setAttribute('formTarget', null);
-shouldBe('input.formTarget', '"null"');
-
-debug('');
-debug('Setting undefined for input:');
-input.formEnctype = undefined;
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('input.getAttribute("formEnctype")', '"undefined"');
-input.setAttribute('formEnctype', undefined);
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-input.formMethod = undefined;
-shouldBe('input.formMethod', '"get"');
-shouldBe('input.getAttribute("formMethod")', '"undefined"');
-input.setAttribute('formMethod', undefined);
-shouldBe('input.formMethod', '"get"');
-input.formTarget = undefined;
-shouldBe('input.formTarget', '"undefined"');
-shouldBe('input.getAttribute("formTarget")', '"undefined"');
-input.setAttribute('formTarget', undefined);
-shouldBe('input.formTarget', '"undefined"');
-
-debug('');
-debug('Setting non-string for input:');
-input.formEnctype = 256;
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('input.getAttribute("formEnctype")', '"256"');
-input.setAttribute('formEnctype', 256);
-shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
-input.formMethod = 256;
-shouldBe('input.formMethod', '"get"');
-shouldBe('input.getAttribute("formMethod")', '"256"');
-input.setAttribute('formMethod', 256);
-shouldBe('input.formMethod', '"get"');
-input.formTarget = 256;
-shouldBe('input.formTarget', '"256"');
-shouldBe('input.getAttribute("formTarget")', '"256"');
-input.setAttribute('formTarget', 256);
-shouldBe('input.formTarget', '"256"');
-
-var button = document.createElement('button');
-debug('');
-debug('Ordinary values for button:');
-button.type = "submit";
-shouldBe('button.formAction', '""');
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('button.formMethod', '"get"');
-shouldBe('button.formTarget', '""');
-
-button.setAttribute('formAction', 'http://localhost');
-shouldBe('button.formAction', '"http://localhost/"');
-button.setAttribute('formAction', 'http://localhost/');
-shouldBe('button.formAction', '"http://localhost/"');
-button.setAttribute('formEnctype', 'text/plain');
-shouldBe('button.formEnctype', '"text/plain"');
-button.setAttribute('formEnctype', 'na');
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-button.setAttribute('formMethod', 'GET');
-shouldBe('button.formMethod', '"get"');
-button.setAttribute('formMethod', 'na');
-shouldBe('button.formMethod', '"get"');
-button.setAttribute('formTarget', '_blank');
-shouldBe('button.formTarget', '"_blank"');
-button.setAttribute('formTarget', 'na');
-shouldBe('button.formTarget', '"na"');
-
-button.formAction = 'http://example.com';
-shouldBe('button.formAction', '"http://example.com/"');
-button.formAction = 'http://example.com/';
-shouldBe('button.formAction', '"http://example.com/"');
-button.formEnctype = 'text/plain';
-shouldBe('button.formEnctype', '"text/plain"');
-button.formEnctype = 'nota';
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-button.formMethod = 'POST';
-shouldBe('button.formMethod', '"post"');
-button.formMethod = 'nota';
-shouldBe('button.formMethod', '"get"');
-button.formTarget = 'http://example.com';
-shouldBe('button.formTarget', '"http://example.com"');
-button.formTarget = 'nota';
-shouldBe('button.formTarget', '"nota"');
-
-debug('');
-debug('Setting null for button:');
-button.formEnctype = null;
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('button.getAttribute("formEnctype")', 'null');
-button.setAttribute('formEnctype', null);
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-button.formMethod = null;
-shouldBe('button.formMethod', '"get"');
-shouldBe('button.getAttribute("formMethod")', 'null');
-button.setAttribute('formMethod', null);
-shouldBe('button.formMethod', '"get"');
-button.formTarget = null;
-shouldBe('button.formTarget', '""');
-shouldBe('button.getAttribute("formTarget")', 'null');
-button.setAttribute('formTarget', null);
-shouldBe('button.formTarget', '"null"');
-
-debug('');
-debug('Setting undefined for button:');
-button.formEnctype = undefined;
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('button.getAttribute("formEnctype")', '"undefined"');
-button.setAttribute('formEnctype', undefined);
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-button.formMethod = undefined;
-shouldBe('button.formMethod', '"get"');
-shouldBe('button.getAttribute("formMethod")', '"undefined"');
-button.setAttribute('formMethod', undefined);
-shouldBe('button.formMethod', '"get"');
-button.formTarget = undefined;
-shouldBe('button.formTarget', '"undefined"');
-shouldBe('button.getAttribute("formTarget")', '"undefined"');
-button.setAttribute('formTarget', undefined);
-shouldBe('button.formTarget', '"undefined"');
-
-debug('');
-debug('Setting non-string for button:');
-button.formEnctype = 256;
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-shouldBe('button.getAttribute("formEnctype")', '"256"');
-button.setAttribute('formEnctype', 512);
-shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
-button.formMethod = 128;
-shouldBe('button.formMethod', '"get"');
-shouldBe('button.getAttribute("formMethod")', '"128"');
-button.setAttribute('formMethod', 17);
-shouldBe('button.formMethod', '"get"');
-button.formTarget = 100;
-shouldBe('button.formTarget', '"100"');
-shouldBe('button.getAttribute("formTarget")', '"100"');
-button.setAttribute('formTarget', 281);
-shouldBe('button.formTarget', '"281"');
diff --git a/LayoutTests/fast/forms/script-tests/text-control-intrinsic-widths.js b/LayoutTests/fast/forms/script-tests/text-control-intrinsic-widths.js
deleted file mode 100644
index 9ef9d3f..0000000
--- a/LayoutTests/fast/forms/script-tests/text-control-intrinsic-widths.js
+++ /dev/null
@@ -1,32 +0,0 @@
-description("This test measures the width of textareas and text inputs for different fonts.");
-
-var sizes = [1, 2, 3, 4, 5, 10, 20, 50, 100, 500, 1000];
-// This list was grabbed from Wikipedia
-// http://en.wikipedia.org/wiki/Core_fonts_for_the_Web
-// Impact was removed from the list as not all versions seem to have the same metrics
-var ms_web_fonts = ['Andale Mono', 'Arial', 'Comic Sans MS', 'Courier New', 'Georgia',
- 'Times New Roman', 'Trebuchet MS', 'Verdana', 'Webdings'];
-
-// These are fonts we expect to see installed on all systems.
-var fonts = ['Lucida Grande', 'Courier', 'Helvetica', 'Monaco', 'Times'].concat(ms_web_fonts);
-
-function printElementWidth(tagname, font) {
- debug('<b>' + tagname + '</b>');
- var node = document.createElement(tagname);
- node.style.fontFamily = font;
- document.body.appendChild(node);
- var sizeProperty = tagname == 'input' ? 'size' : 'cols';
- for (var i = 0; i < sizes.length; i++) {
- node[sizeProperty] = sizes[i];
- debug(sizeProperty + '=' + sizes[i] + ' clientWidth=' + node.clientWidth);
- }
- document.body.removeChild(node);
-}
-
-for (var j = 0; j < fonts.length; j++) {
- debug('<b>' + fonts[j] + '</b>');
- printElementWidth('input', fonts[j]);
- debug('')
- printElementWidth('textarea', fonts[j]);
- debug('');
-}
diff --git a/LayoutTests/fast/forms/script-tests/textarea-maxlength.js b/LayoutTests/fast/forms/script-tests/textarea-maxlength.js
deleted file mode 100644
index d2fdcb0..0000000
--- a/LayoutTests/fast/forms/script-tests/textarea-maxlength.js
+++ /dev/null
@@ -1,153 +0,0 @@
-description('Tests for HTMLTextAreaElement.maxLength behaviors.');
-
-var textArea = document.createElement('textarea');
-document.body.appendChild(textArea);
-
-// No maxlength attribute
-shouldBe('textArea.maxLength', '-1');
-
-// Invalid maxlength attributes
-textArea.setAttribute('maxlength', '-3');
-shouldBe('textArea.maxLength', '-1');
-textArea.setAttribute('maxlength', 'xyz');
-shouldBe('textArea.maxLength', '-1');
-
-// Valid maxlength attributes
-textArea.setAttribute('maxlength', '1');
-shouldBe('textArea.maxLength', '1');
-textArea.setAttribute('maxlength', '256');
-shouldBe('textArea.maxLength', '256');
-
-// Set values to .maxLength
-textArea.maxLength = 13;
-shouldBe('textArea.getAttribute("maxlength")', '"13"');
-
-shouldThrow('textArea.maxLength = -1', '"Error: INDEX_SIZE_ERR: DOM Exception 1"');
-shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed
-
-textArea.maxLength = null;
-shouldBe('textArea.maxLength', '0');
-shouldBe('textArea.getAttribute("maxlength")', '"0"');
-
-// maxLength doesn't truncate the default value.
-textArea = document.createElement('textarea');
-textArea.setAttribute('maxlength', '3');
-textArea.innerHTML = 'abcd';
-document.body.appendChild(textArea);
-shouldBe('textArea.value', '"abcd"');
-
-// maxLength doesn't truncate .value
-textArea.maxLength = 3;
-textArea.value = 'abcde';
-shouldBe('textArea.value', '"abcde"');
-
-// Set up for user-input tests
-function createFocusedTextAreaWithMaxLength(maxLength) {
- if (textArea)
- document.body.removeChild(textArea);
- textArea = document.createElement('textarea');
- textArea.setAttribute('maxlength', maxLength);
- document.body.appendChild(textArea);
- textArea.focus();
-}
-
-// Insert text of which length is maxLength.
-createFocusedTextAreaWithMaxLength(3);
-document.execCommand('insertText', false, 'abc');
-shouldBe('textArea.value', '"abc"');
-
-// Try to add characters to maxLength characters.
-createFocusedTextAreaWithMaxLength(3);
-textArea.value = 'abc';
-document.execCommand('insertText', false, 'def');
-shouldBe('textArea.value', '"abc"');
-
-// Replace text
-createFocusedTextAreaWithMaxLength(3);
-textArea.value = 'abc';
-document.execCommand('selectAll');
-document.execCommand('insertText', false, 'def');
-shouldBe('textArea.value', '"def"');
-
-// Existing value is longer than maxLength. We can't add text.
-createFocusedTextAreaWithMaxLength(3);
-textArea.value = 'abcdef';
-document.execCommand('insertText', false, 'ghi');
-shouldBe('textArea.value', '"abcdef"');
-
-// We can delete a character in the longer value.
-createFocusedTextAreaWithMaxLength(3);
-textArea.value = 'abcdef';
-document.execCommand('delete');
-shouldBe('textArea.value', '"abcde"');
-
-// A linebreak is 1 character.
-createFocusedTextAreaWithMaxLength(4);
-document.execCommand('insertText', false, 'A');
-document.execCommand('insertLineBreak');
-document.execCommand('insertText', false, 'B');
-shouldBe('textArea.value', '"A\\nB"');
-
-// Confirms correct count for close linebreaks inputs.
-createFocusedTextAreaWithMaxLength(3);
-textArea.innerHTML = 'a\n\n';
-document.execCommand('insertLineBreak');
-shouldBe('textArea.value', '"a\\n\\n"');
-
-// Confirms correct count for open consecutive linebreaks inputs.
-createFocusedTextAreaWithMaxLength(6);
-document.execCommand('insertLineBreak');
-document.execCommand('insertLineBreak');
-document.execCommand('insertLineBreak');
-document.execCommand('insertLineBreak');
-shouldBe('textArea.value', '"\\n\\n\\n"');
-
-// According to the HTML5 specification, maxLength is code-point length.
-// However WebKit handles it as grapheme length.
-
-// fancyX should be treated as 1 grapheme.
-var fancyX = "x\u0305\u0332";// + String.fromCharCode(0x305) + String.fromCharCode(0x332);
-// u10000 is one character consisted of a surrogate pair.
-var u10000 = "\ud800\udc00";
-
-// Inserts 5 code-points in UTF-16
-createFocusedTextAreaWithMaxLength(3);
-document.execCommand('insertText', false, 'AB' + fancyX);
-shouldBe('textArea.value', '"AB" + fancyX');
-shouldBe('textArea.value.length', '5');
-
-createFocusedTextAreaWithMaxLength(3);
-textArea.value = 'AB' + fancyX;
-textArea.setSelectionRange(2, 5); // Select fancyX
-document.execCommand('insertText', false, 'CDE');
-shouldBe('textArea.value', '"ABC"');
-
-// Inserts 4 code-points in UTF-16
-createFocusedTextAreaWithMaxLength(3);
-document.execCommand('insertText', false, 'AB' + u10000);
-shouldBe('textArea.value', '"AB" + u10000');
-shouldBe('textArea.value.length', '4');
-
-createFocusedTextAreaWithMaxLength(3);
-textArea.value = 'AB' + u10000;
-textArea.setSelectionRange(2, 4); // Select u10000
-document.execCommand('insertText', false, 'CDE');
-shouldBe('textArea.value', '"ABC"');
-
-// In the case maxlength=0
-createFocusedTextAreaWithMaxLength(0);
-textArea.value = '';
-document.execCommand('insertText', false, 'ABC');
-shouldBe('textArea.value', '""');
-
-// In the case maxlength=''
-createFocusedTextAreaWithMaxLength('');
-textArea.value = '';
-document.execCommand('insertText', false, 'ABC');
-shouldBe('textArea.value', '"ABC"');
-
-// In the case maxlength='invalid'
-createFocusedTextAreaWithMaxLength('invalid');
-textArea.value = '';
-document.execCommand('insertText', false, 'ABC');
-shouldBe('textArea.value', '"ABC"');
diff --git a/LayoutTests/fast/forms/script-tests/textarea-metrics.js b/LayoutTests/fast/forms/script-tests/textarea-metrics.js
deleted file mode 100644
index cee48c8..0000000
--- a/LayoutTests/fast/forms/script-tests/textarea-metrics.js
+++ /dev/null
@@ -1,156 +0,0 @@
-description("This test checks that textareas have the right metrics. These numbers match IE7 except for scrollHeight. For two reasons:<br>" +
-"1. scrollHeight is different for elements without enough content to cause scroll because IE7 then reports the height of the text inside the " +
-"element as the scrollHeight. IE8 reports has scrollHeight == offsetHeight. Gecko/WebKit have scrollHeight == clientHeight.<br>" +
-"2. For the elements with scroll in standards-mode, IE wraps the text differently. It seems to leave 2px less space for the text. We don't " +
-"currently mimic this quirk. It's not clear whether we should given that we agree with IE7's clientWidth numbers in all these cases.");
-
-function assertTextareaMetrics(doc, properties, expectedMetrics) {
- var textarea = doc.createElement('textarea');
- // Give some consistent CSS for consistent rendering across platforms
- // and to help in reasoning when trying to match IE metrics.
- var style = 'overflow-y:auto; font-family:Ahem; line-height:20px; height:50px; width:50px;';
- var title = '';
- for (property in properties) {
- var value = properties[property];
- title += ' ' + property + ': "' + value + '",';
- if (property == 'style')
- style += value;
- else
- textarea[property] = value;
- }
- textarea.style.cssText = style;
- doc.body.appendChild(textarea);
-
- // Create a more human-readable ID.
- var id = title.replace(/[\'\",;\:]/g, ' ').replace(/ +/g, '-');
- id = id == '' ? 'no-styles' : id;
- textarea.id = id;
-
- window[doc.compatMode + 'doc'] = doc;
-
- function assertMetricsForTextarea() {
- if (!title)
- title = ' none';
-
- debug('Properties =' + title);
- shouldBe(doc.compatMode + "doc.getElementById('" + id + "').clientWidth", String(expectedMetrics.clientWidth));
- shouldBe(doc.compatMode + "doc.getElementById('" + id + "').clientHeight", String(expectedMetrics.clientHeight));
- shouldBe(doc.compatMode + "doc.getElementById('" + id + "').offsetWidth", String(expectedMetrics.offsetWidth));
- shouldBe(doc.compatMode + "doc.getElementById('" + id + "').offsetHeight", String(expectedMetrics.offsetHeight));
- shouldBe(doc.compatMode + "doc.getElementById('" + id + "').scrollWidth", String(expectedMetrics.scrollWidth));
- shouldBe(doc.compatMode + "doc.getElementById('" + id + "').scrollHeight", String(expectedMetrics.scrollHeight));
- debug('');
- }
- if (document.all)
- // Give a timeout so IE has time to figure out it's metrics.
- setTimeout(assertMetricsForTextarea, 100);
- else
- assertMetricsForTextarea();
-}
-
-var smallHTML = 'A';
-var htmlThatCausesScroll = 'AAAAAAAAA';
-
-function testTextareasForDocument(doc, compatMode,
- textareaSizes, textareaWithScrollSizes,
- textareaWith8pxPaddingSizes, textareaWith8pxPaddingAndScrollbarSizes) {
- if (doc.compatMode != compatMode)
- testFailed('This doc should be in ' + compatMode + ' mode.');
-
- try {
- var scrollbarStyle = doc.createElement('style');
- scrollbarStyle.innerText = 'textarea::-webkit-scrollbar{ width:17px }';
- doc.getElementsByTagName('head')[0].appendChild(scrollbarStyle);
- } catch (e) {
- // IE throws an exception here, but doesn't need the above clause anyways.
- }
-
- debug('Testing ' + compatMode + ' document.')
- assertTextareaMetrics(doc, {}, textareaSizes);
- assertTextareaMetrics(doc, {disabled: true}, textareaSizes);
- assertTextareaMetrics(doc, {innerHTML: smallHTML}, textareaSizes);
- assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll}, textareaWithScrollSizes);
- assertTextareaMetrics(doc, {innerHTML: smallHTML, disabled: true}, textareaSizes);
- assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll, disabled: true}, textareaWithScrollSizes);
- assertTextareaMetrics(doc, {innerHTML: smallHTML, style: 'padding:8px'}, textareaWith8pxPaddingSizes);
- assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll, style: 'padding:8px'}, textareaWith8pxPaddingAndScrollbarSizes);
- assertTextareaMetrics(doc, {innerHTML: smallHTML, rows: 10}, textareaSizes);
- assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll, rows: 10}, textareaWithScrollSizes);
-}
-
-// For textareas with scrollbars have the expected clientWidth be the
-// expected offsetWidth - scrollbarPlusBorderWidth.
-// default border on textareas is 1px solid. So, the border width is 2.
-// And the scrollbarWidth we set to be 17 to match windows so that
-// these numbers will be platform independent and match IE.
-var scrollbarPlusBorderWidth = 19;
-
-var textareaSizesQuirks = {clientWidth: 48,
- clientHeight: 48,
- offsetWidth: 50,
- offsetHeight: 50,
- scrollWidth: 48,
- scrollHeight: 48};
-
-var textareaWithScrollSizesQuirks = {clientWidth: 50 - scrollbarPlusBorderWidth,
- clientHeight: 48,
- offsetWidth: 50,
- offsetHeight: 50,
- scrollWidth: 50 - scrollbarPlusBorderWidth,
- scrollHeight: 104};
-
-var textareaWith8pxPaddingSizesQuirks = {clientWidth: 48,
- clientHeight: 48,
- offsetWidth: 50,
- offsetHeight: 50,
- scrollWidth: 48,
- scrollHeight: 48};
-
-var textareaWith8pxPaddingAndScrollbarSizesQuirks = {clientWidth: 50 - scrollbarPlusBorderWidth,
- clientHeight: 48,
- offsetWidth: 50,
- offsetHeight: 50,
- scrollWidth: 50 - scrollbarPlusBorderWidth,
- scrollHeight: 196};
-
-testTextareasForDocument(document, 'BackCompat',
- textareaSizesQuirks, textareaWithScrollSizesQuirks,
- textareaWith8pxPaddingSizesQuirks, textareaWith8pxPaddingAndScrollbarSizesQuirks);
-
-var standardsIframe = document.createElement('iframe');
-standardsIframe.style.width = '100%';
-document.body.appendChild(standardsIframe);
-standardsIframe.contentWindow.document.write('<!DocType html><html><head></head><body></body></html>');
-standardsIframe.contentWindow.document.close();
-
-var textareaSizesStandards = {clientWidth: 54,
- clientHeight: 54,
- offsetWidth: 56,
- offsetHeight: 56,
- scrollWidth: 54,
- scrollHeight: 54};
-
-var textareaWithScrollSizesStandards = {clientWidth: 56 - scrollbarPlusBorderWidth,
- clientHeight: 54,
- offsetWidth: 56,
- offsetHeight: 56,
- scrollWidth: 56 - scrollbarPlusBorderWidth,
- scrollHeight: 64};
-
-var textareaWith8pxPaddingSizesStandards = {clientWidth: 66,
- clientHeight: 66,
- offsetWidth: 68,
- offsetHeight: 68,
- scrollWidth: 66,
- scrollHeight: 66};
-
-var textareaWith8pxPaddingAndScrollbarSizesStandards = {clientWidth: 68 - scrollbarPlusBorderWidth,
- clientHeight: 66,
- offsetWidth: 68,
- offsetHeight: 68,
- scrollWidth: 68 - scrollbarPlusBorderWidth,
- scrollHeight: 76};
-
-testTextareasForDocument(standardsIframe.contentWindow.document, 'CSS1Compat',
- textareaSizesStandards, textareaWithScrollSizesStandards,
- textareaWith8pxPaddingSizesStandards, textareaWith8pxPaddingAndScrollbarSizesStandards);
diff --git a/LayoutTests/fast/forms/script-tests/textarea-placeholder-dom-property.js b/LayoutTests/fast/forms/script-tests/textarea-placeholder-dom-property.js
deleted file mode 100644
index 6a7285f..0000000
--- a/LayoutTests/fast/forms/script-tests/textarea-placeholder-dom-property.js
+++ /dev/null
@@ -1,13 +0,0 @@
-description('Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=21248">https://bugs.webkit.org/show_bug.cgi?id=21248</a>');
-
-var textarea = document.createElement('textarea');
-
-shouldBeEqualToString('textarea.placeholder', '');
-
-textarea.setAttribute('placeholder', 'p1')
-shouldBeEqualToString('textarea.placeholder', 'p1');
-shouldBeEqualToString('textarea.value', '');
-
-textarea.placeholder = 'p2';
-shouldBeEqualToString('textarea.getAttribute("placeholder")', 'p2');
-shouldBeEqualToString('textarea.placeholder', 'p2');
diff --git a/LayoutTests/fast/forms/script-tests/textarea-rows-cols.js b/LayoutTests/fast/forms/script-tests/textarea-rows-cols.js
deleted file mode 100644
index 710877b..0000000
--- a/LayoutTests/fast/forms/script-tests/textarea-rows-cols.js
+++ /dev/null
@@ -1,116 +0,0 @@
-description('Test for edge cases of <textarea> rows and cols attributes.');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-parent.innerHTML = '<textarea>default</textarea>';
-
-debug('Default values');
-var textarea = parent.firstChild;
-var defaultRows = textarea.rows;
-var defaultCols = textarea.cols;
-var defaultHeight = textarea.offsetHeight;
-var defaultWidth = textarea.offsetWidth;
-shouldBe('defaultRows', '2');
-shouldBe('defaultCols', '20');
-shouldBeTrue('defaultHeight > 0');
-shouldBeTrue('defaultWidth > 0');
-
-debug('rows = 1');
-parent.innerHTML = '<textarea rows="1">rows = 1</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', '1');
-shouldBeTrue('textarea.offsetHeight > 0');
-shouldBeTrue('textarea.offsetHeight < defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('rows = 2; should match default height');
-parent.innerHTML = '<textarea rows="2">rows = 2; should match default height</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', 'defaultRows');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('rows = 3');
-parent.innerHTML = '<textarea rows="3">rows = 3</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', '3');
-shouldBeTrue('textarea.offsetHeight > defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('rows; should be default height');
-parent.innerHTML = '<textarea rows>rows; should be default height</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', 'defaultRows');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('rows = 0; should be default height');
-parent.innerHTML = '<textarea rows="0">rows = 0; should be default height</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', 'defaultRows');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('rows = -1; should be default height');
-parent.innerHTML = '<textarea rows="-1">rows = -1; should be default height</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', 'defaultRows');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('rows = x; should be default height');
-parent.innerHTML = '<textarea rows="x">rows = x; should be default height</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.rows', 'defaultRows');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-
-debug('cols = 1');
-parent.innerHTML = '<textarea cols="1">cols = 1</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', '1');
-shouldBeTrue('textarea.offsetWidth > 0');
-shouldBeTrue('textarea.offsetWidth < defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-
-debug('cols = 20; should match default width');
-parent.innerHTML = '<textarea cols="20">cols = 20; should match default width</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', 'defaultCols');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-
-debug('cols = 40');
-parent.innerHTML = '<textarea cols="40">cols = 40</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', '40');
-shouldBeTrue('textarea.offsetWidth > defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-
-debug('cols; should be default width');
-parent.innerHTML = '<textarea cols>cols; should be default width</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', 'defaultCols');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-
-debug('cols = 0; should be default width');
-parent.innerHTML = '<textarea cols="0">cols = 0; should be default width</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', 'defaultCols');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-
-debug('cols = -1; should be default width');
-parent.innerHTML = '<textarea cols="-1">cols = -1; should be default width</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', 'defaultCols');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
-
-debug('cols = x; should be default width');
-parent.innerHTML = '<textarea cols="x">cols = x; should be default width</textarea>';
-textarea = parent.firstChild;
-shouldBe('textarea.cols', 'defaultCols');
-shouldBe('textarea.offsetWidth', 'defaultWidth');
-shouldBe('textarea.offsetHeight', 'defaultHeight');
diff --git a/LayoutTests/fast/forms/script-tests/textarea-textlength.js b/LayoutTests/fast/forms/script-tests/textarea-textlength.js
deleted file mode 100644
index 0e7cef5..0000000
--- a/LayoutTests/fast/forms/script-tests/textarea-textlength.js
+++ /dev/null
@@ -1,28 +0,0 @@
-description('Test for HTMLTextAreaElement.textLength');
-
-var textArea = document.createElement('textarea');
-document.body.appendChild(textArea);
-shouldBe('textArea.textLength', '0');
-
-textArea.value = 'abcd';
-shouldBe('textArea.textLength', '4');
-
-textArea.focus();
-eventSender.keyDown('e', []);
-shouldBe('textArea.textLength', '5');
-
-// Test for a character larger than U+FFFF.
-textArea = document.createElement('textarea');
-textArea.innerHTML = '𝔸';
-// Firefox 3.5 and Opera 10 return 2 for 1 surrogate pair.
-shouldBe('textArea.textLength', '2');
-
-// Test for combined characters.
-textArea = document.createElement('textarea');
-// U+3055 Hiragana Letter Sa
-// U+3099 Combining Katakana-HIragana Voiced Sound Mark
-textArea.innerHTML = 'ざ';
-// Firefox 3.5 seems to apply NFC for the value, and .textLength and .value.length is 1.
-// Opera 10 returns 2, and IE's .value.length is 2.
-shouldBe('textArea.textLength', '2');
-
diff --git a/LayoutTests/fast/forms/script-tests/validationMessage.js b/LayoutTests/fast/forms/script-tests/validationMessage.js
deleted file mode 100644
index 45cac37..0000000
--- a/LayoutTests/fast/forms/script-tests/validationMessage.js
+++ /dev/null
@@ -1,81 +0,0 @@
-description("Test for validationMessage DOM property.");
-
-var form = document.createElement("form");
-
-// An input element with a pattern set and a mismatched value
-var patternInput = document.createElement("input");
-patternInput.name = "patternInput";
-patternInput.pattern = "lorem ipsum";
-patternInput.value = "lorem";
-form.appendChild(patternInput);
-shouldBe("patternInput.validationMessage", "'pattern mismatch'");
-
-// A required input with an empty value
-var requiredInput = document.createElement("input");
-requiredInput.name = "requiredInput";
-requiredInput.required = true;
-form.appendChild(requiredInput);
-shouldBe("requiredInput.validationMessage", "'value missing'");
-
-// A required textarea with an empty value
-var requiredTextArea = document.createElement("textarea");
-requiredTextArea.name = "requiredTextArea";
-requiredTextArea.required = true;
-form.appendChild(requiredTextArea);
-shouldBe("requiredTextArea.validationMessage", "'value missing'");
-
-// A required select with an empty value
-var requiredSelect = document.createElement("select");
-requiredSelect.name = "requiredSelect";
-requiredSelect.required = true;
-form.appendChild(requiredSelect);
-shouldBe("requiredSelect.validationMessage", "'value missing'");
-
-// A type=email input for the "type mismatch" flag
-var emailInput = document.createElement("input");
-emailInput.name = "emailInput";
-emailInput.type = "email";
-emailInput.value = "incorrectValue";
-form.appendChild(emailInput);
-shouldBe("emailInput.validationMessage", "'type mismatch'");
-
-// A button can't be valited and, thus, has a blank validationMessage
-var but = document.createElement("button");
-but.name = "button";
-form.appendChild(but);
-shouldBe("but.validationMessage", "''");
-
-// An input control with no name, so it can't be validated (willValidate = false)
-var anoninput = document.createElement("input");
-form.appendChild(anoninput);
-shouldBe("anoninput.validationMessage", "''")
-
-// Fieldsets can't be validated
-var happyFieldset = document.createElement("fieldset");
-happyFieldset.name = "fieldset";
-form.appendChild(happyFieldset);
-shouldBe("happyFieldset.validationMessage", "''");
-
-// Select controls can't be validated too
-var happySelect = document.createElement("select");
-happySelect.name = "select";
-form.appendChild(happySelect);
-shouldBe("happySelect.validationMessage", "''");
-
-// Output elements can't be validated
-var happyOutput = document.createElement("output");
-happySelect.name = "output";
-form.appendChild(happyOutput);
-shouldBe("happyOutput.validationMessage", "''");
-
-// Object elements can't be validated
-var happyObject = document.createElement("object");
-happySelect.name = "object";
-form.appendChild(happyObject);
-shouldBe("happyObject.validationMessage", "''");
-
-// Keygen controls can't be validated
-var happyKeygen = document.createElement("keygen");
-happySelect.name = "keygen";
-form.appendChild(happyKeygen);
-shouldBe("happyKeygen.validationMessage", "''");
diff --git a/LayoutTests/fast/forms/script-tests/willvalidate.js b/LayoutTests/fast/forms/script-tests/willvalidate.js
deleted file mode 100644
index ba7e74a..0000000
--- a/LayoutTests/fast/forms/script-tests/willvalidate.js
+++ /dev/null
@@ -1,84 +0,0 @@
-description('Various tests for .willValidate property');
-
-var parent = document.createElement('div');
-document.body.appendChild(parent);
-
-debug('Existence of .willValidate');
-parent.innerHTML = '<form>'
- + '<input name="victim"/>'
- + '<textarea name="victim"></textarea>'
- + '<fieldset name="victim">Test</fieldset>'
- + '<button name="victim">'
- + '<select name="victim"></select>'
- + '<output name="victim"></output>'
- + '<object name="victim"></object>'
- + '<keygen name="victim">'
- + '</form>';
-var controls = document.getElementsByName('victim');
- for (var i = 0; i < controls.length; i++)
- shouldBe('typeof controls[i].willValidate', '"boolean"');
-
-debug('');
-debug('Form association');
-parent.innerHTML = '<input name="test">';
-var input = document.getElementsByTagName("input")[0];
-shouldBeTrue('input.willValidate');
-parent.innerHTML = '<form><input name="test"></form>';
-input = document.getElementsByTagName("input")[0];
-shouldBeTrue('input.willValidate');
-
-debug('');
-debug('Control name');
-parent.innerHTML = '<form><input></form>';
-input = document.getElementsByTagName("input")[0];
-shouldBeTrue('input.willValidate');
-parent.innerHTML = '<form><input name="test"></form>';
-input = document.getElementsByTagName("input")[0];
-shouldBeTrue('input.willValidate');
-
-debug('');
-debug('Disabled control');
-parent.innerHTML = '<form><input name="test" disabled></form>';
-input = document.getElementsByTagName("input")[0];
-shouldBeFalse('input.willValidate');
-
-debug('');
-debug('Read-only control');
-parent.innerHTML = '<form><input name="test" readonly></form>';
-input = document.getElementsByTagName("input")[0];
-shouldBeFalse('input.willValidate');
-
-debug('');
-debug('Input types');
-parent.innerHTML = '<form><input name="test"></form>';
-input = document.getElementsByTagName("input")[0];
-shouldBeTrue('input.willValidate');
-shouldBeFalse('input.type = "button"; input.willValidate');
-shouldBeTrue('input.type = "submit"; input.willValidate');
-shouldBeFalse('input.type = "hidden"; input.willValidate');
-shouldBeFalse('input.type = "reset"; input.willValidate');
-
-debug('');
-debug('Fieldset element');
-parent.innerHTML = '<form><fieldset><p>Fieldset test</p></fieldtset></form>';
-shouldBeFalse('document.getElementsByTagName("fieldset")[0].willValidate');
-
-debug('');
-debug('Textarea element');
-parent.innerHTML = '<form><textarea name="text"></textarea></form>';
-shouldBeTrue('document.getElementsByTagName("textarea")[0].willValidate');
-
-debug('');
-debug('Output element');
-parent.innerHTML = '<form><output></output></form>';
-shouldBeFalse('document.getElementsByTagName("output")[0].willValidate');
-
-debug('');
-debug('Object element');
-parent.innerHTML = '<form><object></object></form>';
-shouldBeFalse('document.getElementsByTagName("object")[0].willValidate');
-
-debug('');
-debug('Keygen element');
-parent.innerHTML = '<form><keygen></form>';
-shouldBeFalse('document.getElementsByTagName("keygen")[0].willValidate');
diff --git a/LayoutTests/fast/forms/search-cancel-button-events.html b/LayoutTests/fast/forms/search-cancel-button-events.html
index de11731..c191421 100644
--- a/LayoutTests/fast/forms/search-cancel-button-events.html
+++ b/LayoutTests/fast/forms/search-cancel-button-events.html
@@ -6,7 +6,43 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/search-cancel-button-events.js"></script>
+<script>
+description('Test for event dipatching by search cancel button.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type=search id=search value=foo><input id=another>';
+var search = document.getElementById('search');
+var anotherInput = document.getElementById('another');
+var inputEventCounter = 0;
+var changeEventCounter = 0;
+
+search.onchange = function() { changeEventCounter++; };
+search.oninput = function() { inputEventCounter++; };
+
+if (window.eventSender) {
+ debug('Initial state');
+ shouldBe('changeEventCounter', '0');
+ shouldBe('inputEventCounter', '0');
+
+ debug('Click the cancel button');
+ eventSender.mouseMoveTo(search.offsetLeft + search.offsetWidth - 8, search.offsetTop + search.offsetHeight / 2);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ shouldBe('search.value', '""');
+ shouldBe('changeEventCounter', '0');
+ shouldBe('inputEventCounter', '1');
+
+ debug('Focus on another field');
+ anotherInput.focus();
+ shouldBe('changeEventCounter', '1');
+ shouldBe('inputEventCounter', '1');
+
+ parent.innerHTML = '';
+} else {
+ document.getElementById('console').innerHTML = 'No eventSender';
+}
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/select-set-length-optgroup.html b/LayoutTests/fast/forms/select-set-length-optgroup.html
index d6c3c06..9dad06e 100644
--- a/LayoutTests/fast/forms/select-set-length-optgroup.html
+++ b/LayoutTests/fast/forms/select-set-length-optgroup.html
@@ -6,7 +6,36 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/select-set-length-optgroup.js"></script>
+<script>
+description('This test that setting HTMLSelectElement.length respects optgroups.');
+
+var wrapper = document.createElement('div');
+document.body.appendChild(wrapper);
+wrapper.innerHTML = '<select id="theSelect">'+
+ '<optgroup label="foo" id="theOptGroup">'+
+ '<option id="optionInGroup"></option>'+
+ '</optgroup>'+
+ '</select>';
+
+var sel = document.getElementById('theSelect');
+shouldBe('sel.length', '1');
+
+var og = document.getElementById('theOptGroup');
+
+sel.length = 2;
+shouldBe('sel.length', '2');
+shouldBe('og.childElementCount', '1');
+
+sel.length = 1;
+shouldBe('sel.length', '1');
+shouldBe('og.childElementCount', '1');
+
+sel.insertBefore(document.createElement('option'), og);
+
+sel.length = 1;
+shouldBe('sel.length', '1');
+shouldBe('og.childElementCount', '0');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/select-set-length-with-mutation-remove.html b/LayoutTests/fast/forms/select-set-length-with-mutation-remove.html
index 5189d80..91c7ed5 100644
--- a/LayoutTests/fast/forms/select-set-length-with-mutation-remove.html
+++ b/LayoutTests/fast/forms/select-set-length-with-mutation-remove.html
@@ -6,7 +6,43 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/select-set-length-with-mutation-remove.js"></script>
+<script>
+description('Tests that setting .length on an HTMLSelectElement works in the presence of mutation listeners that remove option elements.');
+
+function gc() {
+ if (window.GCController)
+ return GCController.collect();
+
+ for (var i=0; i<10000; ++i) {
+ var s = new String("abc");
+ }
+}
+
+function onRemove(e) {
+ if (e.target.nextSibling != null) {
+ // remove listener temporarily to avoid lots of nesting
+ sel.removeEventListener('DOMNodeRemoved', onRemove, false);
+ e.target.nextSibling.parentNode.removeChild(e.target.nextSibling);
+ sel.addEventListener('DOMNodeRemoved', onRemove, false);
+ }
+ gc();
+}
+
+var sel = document.createElement('select');
+document.body.appendChild(sel);
+
+sel.addEventListener('DOMNodeRemoved', onRemove, false);
+sel.addEventListener('DOMNodeInserted', function() {}, false);
+
+sel.length = 200;
+shouldBe('sel.length', '200');
+
+sel.length = 100;
+shouldBe('sel.length', '100');
+
+sel.length = 180;
+shouldBe('sel.length', '180');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/select-set-length-with-mutation-reorder.html b/LayoutTests/fast/forms/select-set-length-with-mutation-reorder.html
index edffc3c..441168f 100644
--- a/LayoutTests/fast/forms/select-set-length-with-mutation-reorder.html
+++ b/LayoutTests/fast/forms/select-set-length-with-mutation-reorder.html
@@ -6,7 +6,42 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/select-set-length-with-mutation-reorder.js"></script>
+<script>
+description('Tests that setting the .length on an HTMLSelectElement works in the presence of DOM mutation listeners that reorder option elements');
+
+var wrapper = document.createElement('div');
+document.body.appendChild(wrapper);
+wrapper.innerHTML = '<select id="theSelect">' +
+ '<option id="a">a</option>' +
+ '<option id="b">b</option>' +
+ '<option id="c">c</option>' +
+ '<option id="d">d</option>' +
+ '</select>';
+
+var sel = document.getElementById('theSelect');
+
+var firstRemove = true;
+function onRemove(e) {
+ if (firstRemove) {
+ // remove listener temporarily to avoid lots of nesting
+ sel.removeEventListener('DOMNodeRemoved', onRemove, false);
+ var lastOption = document.getElementById('d');
+ sel.removeChild(lastOption);
+ sel.insertBefore(lastOption, document.getElementById('c'));
+ firstRemove = false;
+ sel.addEventListener('DOMNodeRemoved', onRemove, false);
+ }
+}
+
+sel.addEventListener('DOMNodeRemoved', onRemove, false);
+sel.addEventListener('DOMNodeInserted', function() {}, false);
+
+shouldBe('sel.length', '4');
+sel.length = 2;
+shouldBe('sel.length', '2');
+shouldBe('sel.options.item(0).id', '"a"');
+shouldBe('sel.options.item(1).id', '"b"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/select-set-length-with-mutation-reparent.html b/LayoutTests/fast/forms/select-set-length-with-mutation-reparent.html
index 81431aa..aabd671 100644
--- a/LayoutTests/fast/forms/select-set-length-with-mutation-reparent.html
+++ b/LayoutTests/fast/forms/select-set-length-with-mutation-reparent.html
@@ -6,7 +6,40 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/select-set-length-with-mutation-reparent.js"></script>
+<script>
+description('Tests that setting .length on an HTMLSelectElement works in the presence of mutation event listeners that reparent options');
+
+var sel = document.createElement('select');
+document.body.appendChild(sel);
+var otherSel = document.createElement('select');
+document.body.appendChild(otherSel);
+
+function onRemove(e) {
+ if (e.target.nextSibling != null) {
+ // remove listener temporarily to avoid lots of nesting
+ sel.removeEventListener('DOMNodeRemoved', onRemove, false);
+ var n = e.target.nextSibling;
+ n.parentNode.removeChild(n);
+ otherSel.appendChild(n);
+ sel.addEventListener('DOMNodeRemoved', onRemove, false);
+ }
+}
+
+sel.addEventListener('DOMNodeRemoved', onRemove, false);
+sel.addEventListener('DOMNodeInserted', function() {}, false);
+
+sel.length = 200;
+shouldBe('sel.length', '200');
+shouldBe('otherSel.length', '0');
+
+sel.length = 100;
+shouldBe('sel.length', '100');
+shouldBe('otherSel.length', '0');
+
+sel.length = 180;
+shouldBe('sel.length', '180');
+shouldBe('otherSel.length', '0');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/select-set-length-with-mutation.html b/LayoutTests/fast/forms/select-set-length-with-mutation.html
index a984ad0..a01e9d4 100644
--- a/LayoutTests/fast/forms/select-set-length-with-mutation.html
+++ b/LayoutTests/fast/forms/select-set-length-with-mutation.html
@@ -6,7 +6,24 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/select-set-length-with-mutation.js"></script>
+<script>
+description('Tests setting the .length of an HTMLSelectElement with mutation listeners registered.');
+
+var sel = document.createElement('select');
+document.body.appendChild(sel);
+
+sel.addEventListener('DOMNodeRemoved', function() {}, false);
+sel.addEventListener('DOMNodeInserted', function() {}, false);
+
+sel.length = 200;
+shouldBe('sel.length', '200');
+
+sel.length = 100;
+shouldBe('sel.length', '100');
+
+sel.length = 180;
+shouldBe('sel.length', '180');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/select-set-length.html b/LayoutTests/fast/forms/select-set-length.html
index 67ecc77..dadbebe 100644
--- a/LayoutTests/fast/forms/select-set-length.html
+++ b/LayoutTests/fast/forms/select-set-length.html
@@ -6,7 +6,23 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/select-set-length.js"></script>
+<script>
+description('Tests that setting the .length of an HTMLSelectElement correctly creates and destroys options.');
+
+var sel = document.createElement('select');
+document.body.appendChild(sel);
+
+shouldBe('sel.length', '0');
+
+sel.length = 200;
+shouldBe('sel.length', '200');
+
+sel.length = 100;
+shouldBe('sel.length', '100');
+
+sel.length = 180;
+shouldBe('sel.length', '180');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/setCustomValidity-existence.html b/LayoutTests/fast/forms/setCustomValidity-existence.html
index c63445f..8bb2910 100644
--- a/LayoutTests/fast/forms/setCustomValidity-existence.html
+++ b/LayoutTests/fast/forms/setCustomValidity-existence.html
@@ -6,7 +6,33 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/setCustomValidity-existence.js"></script>
+<script>
+description('Existence tests for .setCustomValidity property');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+
+debug('Existence of .setCustomValidity');
+parent.innerHTML = '<form>'
+ + '<input name="victim"/>'
+ + '<textarea name="victim"></textarea>'
+ + '<fieldset name="victim">Test</fieldset>'
+ + '<button name="victim">'
+ + '<select name="victim"></select>'
+ + '<output name="victim"></output>'
+ + '<object name="victim"></object>'
+ + '<keygen name="victim">'
+ + '</form>';
+
+shouldBe('typeof document.getElementsByTagName("input")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("button")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("fieldset")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("select")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("textarea")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("output")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("object")[0].setCustomValidity', '"function"');
+shouldBe('typeof document.getElementsByTagName("keygen")[0].setCustomValidity', '"function"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/shadow-tree-exposure.html b/LayoutTests/fast/forms/shadow-tree-exposure.html
index 1969f31..b0506b0 100644
--- a/LayoutTests/fast/forms/shadow-tree-exposure.html
+++ b/LayoutTests/fast/forms/shadow-tree-exposure.html
@@ -6,7 +6,81 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/shadow-tree-exposure.js"></script>
+<script>
+description("Test to make sure shadow nodes are not exposed.");
+
+var container = document.createElement("p");
+document.body.appendChild(container);
+
+container.appendChild(document.createTextNode("Some text: "));
+
+shouldBe("getSelection().anchorNode", "null");
+shouldBe("getSelection().anchorOffset", "0");
+shouldBe("getSelection().focusNode", "null");
+shouldBe("getSelection().focusOffset", "0");
+shouldBe("getSelection().isCollapsed", "true");
+shouldBe("getSelection().rangeCount", "0");
+
+shouldBe("getSelection().baseNode", "null");
+shouldBe("getSelection().baseOffset", "0");
+shouldBe("getSelection().extentNode", "null");
+shouldBe("getSelection().extentOffset", "0");
+shouldBe("getSelection().type", "'None'");
+
+debug("\nAdd an input element.\n");
+
+var input = document.createElement("input");
+container.appendChild(input);
+input.value = "text";
+input.focus();
+input.select();
+
+shouldBe("getSelection().anchorNode", "container");
+shouldBe("getSelection().anchorOffset", "1");
+shouldBe("getSelection().focusNode", "container");
+shouldBe("getSelection().focusOffset", "1");
+shouldBe("getSelection().isCollapsed", "true");
+shouldBe("getSelection().rangeCount", "1");
+shouldBe("getSelection().getRangeAt(0).startContainer", "container");
+shouldBe("getSelection().getRangeAt(0).startOffset", "1");
+shouldBe("getSelection().getRangeAt(0).endContainer", "container");
+shouldBe("getSelection().getRangeAt(0).endOffset", "1");
+
+shouldBe("getSelection().baseNode", "container");
+shouldBe("getSelection().baseOffset", "1");
+shouldBe("getSelection().extentNode", "container");
+shouldBe("getSelection().extentOffset", "1");
+shouldBe("getSelection().type", "'Range'");
+
+debug("\nAdd a textarea element.\n");
+
+var textarea = document.createElement("textarea");
+container.appendChild(textarea);
+textarea.value = "text";
+textarea.focus();
+textarea.select();
+
+shouldBe("getSelection().anchorNode", "container");
+shouldBe("getSelection().anchorOffset", "2");
+shouldBe("getSelection().focusNode", "container");
+shouldBe("getSelection().focusOffset", "2");
+shouldBe("getSelection().isCollapsed", "true");
+shouldBe("getSelection().rangeCount", "1");
+shouldBe("getSelection().getRangeAt(0).startContainer", "container");
+shouldBe("getSelection().getRangeAt(0).startOffset", "2");
+shouldBe("getSelection().getRangeAt(0).endContainer", "container");
+shouldBe("getSelection().getRangeAt(0).endOffset", "2");
+
+shouldBe("getSelection().baseNode", "container");
+shouldBe("getSelection().baseOffset", "2");
+shouldBe("getSelection().extentNode", "container");
+shouldBe("getSelection().extentOffset", "2");
+shouldBe("getSelection().type", "'Range'");
+
+document.body.removeChild(container);
+
+debug("");
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/submit-form-attributes.html b/LayoutTests/fast/forms/submit-form-attributes.html
index bffc9ee..61c4c9b 100644
--- a/LayoutTests/fast/forms/submit-form-attributes.html
+++ b/LayoutTests/fast/forms/submit-form-attributes.html
@@ -6,7 +6,203 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/submit-form-attributes.js"></script>
+<script>
+description('Tests the behavior of .formaction, .formenctype, .formmethod and .formtarget of HTMLInputElement and HTMLButtonElement.');
+
+var input = document.createElement('input');
+
+debug('Ordinary values for input:');
+input.type = "submit";
+shouldBe('input.formAction', '""');
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('input.formMethod', '"get"');
+shouldBe('input.formTarget', '""');
+
+input.setAttribute('formAction', 'http://localhost');
+shouldBe('input.formAction', '"http://localhost/"');
+input.setAttribute('formAction', 'http://localhost/');
+shouldBe('input.formAction', '"http://localhost/"');
+input.setAttribute('formEnctype', 'text/plain');
+shouldBe('input.formEnctype', '"text/plain"');
+input.setAttribute('formEnctype', 'na');
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+input.setAttribute('formMethod', 'GET');
+shouldBe('input.formMethod', '"get"');
+input.setAttribute('formMethod', 'ni');
+shouldBe('input.formMethod', '"get"');
+input.setAttribute('formTarget', '_blank');
+shouldBe('input.formTarget', '"_blank"');
+input.setAttribute('formTarget', 'nu');
+shouldBe('input.formTarget', '"nu"');
+
+input.formAction = 'http://example.com';
+shouldBe('input.formAction', '"http://example.com/"');
+input.formAction = 'http://example.com/';
+shouldBe('input.formAction', '"http://example.com/"');
+input.formEnctype = 'text/plain';
+shouldBe('input.formEnctype', '"text/plain"');
+input.formEnctype = 'nota';
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+input.formMethod = 'POST';
+shouldBe('input.formMethod', '"post"');
+input.formMethod = 'neta';
+shouldBe('input.formMethod', '"get"');
+input.formTarget = 'http://example.com';
+shouldBe('input.formTarget', '"http://example.com"');
+input.formTarget = 'nta';
+shouldBe('input.formTarget', '"nta"');
+
+debug('');
+debug('Setting null for input:');
+input.formEnctype = null;
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('input.getAttribute("formEnctype")', 'null');
+input.setAttribute('formEnctype', null);
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+input.formMethod = null;
+shouldBe('input.formMethod', '"get"');
+shouldBe('input.getAttribute("formMethod")', 'null');
+input.setAttribute('formMethod', null);
+shouldBe('input.formMethod', '"get"');
+input.formTarget = null;
+shouldBe('input.formTarget', '""');
+shouldBe('input.getAttribute("formTarget")', 'null');
+input.setAttribute('formTarget', null);
+shouldBe('input.formTarget', '"null"');
+
+debug('');
+debug('Setting undefined for input:');
+input.formEnctype = undefined;
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('input.getAttribute("formEnctype")', '"undefined"');
+input.setAttribute('formEnctype', undefined);
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+input.formMethod = undefined;
+shouldBe('input.formMethod', '"get"');
+shouldBe('input.getAttribute("formMethod")', '"undefined"');
+input.setAttribute('formMethod', undefined);
+shouldBe('input.formMethod', '"get"');
+input.formTarget = undefined;
+shouldBe('input.formTarget', '"undefined"');
+shouldBe('input.getAttribute("formTarget")', '"undefined"');
+input.setAttribute('formTarget', undefined);
+shouldBe('input.formTarget', '"undefined"');
+
+debug('');
+debug('Setting non-string for input:');
+input.formEnctype = 256;
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('input.getAttribute("formEnctype")', '"256"');
+input.setAttribute('formEnctype', 256);
+shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"');
+input.formMethod = 256;
+shouldBe('input.formMethod', '"get"');
+shouldBe('input.getAttribute("formMethod")', '"256"');
+input.setAttribute('formMethod', 256);
+shouldBe('input.formMethod', '"get"');
+input.formTarget = 256;
+shouldBe('input.formTarget', '"256"');
+shouldBe('input.getAttribute("formTarget")', '"256"');
+input.setAttribute('formTarget', 256);
+shouldBe('input.formTarget', '"256"');
+
+var button = document.createElement('button');
+debug('');
+debug('Ordinary values for button:');
+button.type = "submit";
+shouldBe('button.formAction', '""');
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('button.formMethod', '"get"');
+shouldBe('button.formTarget', '""');
+
+button.setAttribute('formAction', 'http://localhost');
+shouldBe('button.formAction', '"http://localhost/"');
+button.setAttribute('formAction', 'http://localhost/');
+shouldBe('button.formAction', '"http://localhost/"');
+button.setAttribute('formEnctype', 'text/plain');
+shouldBe('button.formEnctype', '"text/plain"');
+button.setAttribute('formEnctype', 'na');
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+button.setAttribute('formMethod', 'GET');
+shouldBe('button.formMethod', '"get"');
+button.setAttribute('formMethod', 'na');
+shouldBe('button.formMethod', '"get"');
+button.setAttribute('formTarget', '_blank');
+shouldBe('button.formTarget', '"_blank"');
+button.setAttribute('formTarget', 'na');
+shouldBe('button.formTarget', '"na"');
+
+button.formAction = 'http://example.com';
+shouldBe('button.formAction', '"http://example.com/"');
+button.formAction = 'http://example.com/';
+shouldBe('button.formAction', '"http://example.com/"');
+button.formEnctype = 'text/plain';
+shouldBe('button.formEnctype', '"text/plain"');
+button.formEnctype = 'nota';
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+button.formMethod = 'POST';
+shouldBe('button.formMethod', '"post"');
+button.formMethod = 'nota';
+shouldBe('button.formMethod', '"get"');
+button.formTarget = 'http://example.com';
+shouldBe('button.formTarget', '"http://example.com"');
+button.formTarget = 'nota';
+shouldBe('button.formTarget', '"nota"');
+
+debug('');
+debug('Setting null for button:');
+button.formEnctype = null;
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('button.getAttribute("formEnctype")', 'null');
+button.setAttribute('formEnctype', null);
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+button.formMethod = null;
+shouldBe('button.formMethod', '"get"');
+shouldBe('button.getAttribute("formMethod")', 'null');
+button.setAttribute('formMethod', null);
+shouldBe('button.formMethod', '"get"');
+button.formTarget = null;
+shouldBe('button.formTarget', '""');
+shouldBe('button.getAttribute("formTarget")', 'null');
+button.setAttribute('formTarget', null);
+shouldBe('button.formTarget', '"null"');
+
+debug('');
+debug('Setting undefined for button:');
+button.formEnctype = undefined;
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('button.getAttribute("formEnctype")', '"undefined"');
+button.setAttribute('formEnctype', undefined);
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+button.formMethod = undefined;
+shouldBe('button.formMethod', '"get"');
+shouldBe('button.getAttribute("formMethod")', '"undefined"');
+button.setAttribute('formMethod', undefined);
+shouldBe('button.formMethod', '"get"');
+button.formTarget = undefined;
+shouldBe('button.formTarget', '"undefined"');
+shouldBe('button.getAttribute("formTarget")', '"undefined"');
+button.setAttribute('formTarget', undefined);
+shouldBe('button.formTarget', '"undefined"');
+
+debug('');
+debug('Setting non-string for button:');
+button.formEnctype = 256;
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+shouldBe('button.getAttribute("formEnctype")', '"256"');
+button.setAttribute('formEnctype', 512);
+shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"');
+button.formMethod = 128;
+shouldBe('button.formMethod', '"get"');
+shouldBe('button.getAttribute("formMethod")', '"128"');
+button.setAttribute('formMethod', 17);
+shouldBe('button.formMethod', '"get"');
+button.formTarget = 100;
+shouldBe('button.formTarget', '"100"');
+shouldBe('button.getAttribute("formTarget")', '"100"');
+button.setAttribute('formTarget', 281);
+shouldBe('button.formTarget', '"281"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/text-control-intrinsic-widths.html b/LayoutTests/fast/forms/text-control-intrinsic-widths.html
index 0c7a7ac..f9f6d28 100644
--- a/LayoutTests/fast/forms/text-control-intrinsic-widths.html
+++ b/LayoutTests/fast/forms/text-control-intrinsic-widths.html
@@ -6,7 +6,40 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/text-control-intrinsic-widths.js"></script>
+<script>
+description("This test measures the width of textareas and text inputs for different fonts.");
+
+var sizes = [1, 2, 3, 4, 5, 10, 20, 50, 100, 500, 1000];
+// This list was grabbed from Wikipedia
+// http://en.wikipedia.org/wiki/Core_fonts_for_the_Web
+// Impact was removed from the list as not all versions seem to have the same metrics
+var ms_web_fonts = ['Andale Mono', 'Arial', 'Comic Sans MS', 'Courier New', 'Georgia',
+ 'Times New Roman', 'Trebuchet MS', 'Verdana', 'Webdings'];
+
+// These are fonts we expect to see installed on all systems.
+var fonts = ['Lucida Grande', 'Courier', 'Helvetica', 'Monaco', 'Times'].concat(ms_web_fonts);
+
+function printElementWidth(tagname, font) {
+ debug('<b>' + tagname + '</b>');
+ var node = document.createElement(tagname);
+ node.style.fontFamily = font;
+ document.body.appendChild(node);
+ var sizeProperty = tagname == 'input' ? 'size' : 'cols';
+ for (var i = 0; i < sizes.length; i++) {
+ node[sizeProperty] = sizes[i];
+ debug(sizeProperty + '=' + sizes[i] + ' clientWidth=' + node.clientWidth);
+ }
+ document.body.removeChild(node);
+}
+
+for (var j = 0; j < fonts.length; j++) {
+ debug('<b>' + fonts[j] + '</b>');
+ printElementWidth('input', fonts[j]);
+ debug('')
+ printElementWidth('textarea', fonts[j]);
+ debug('');
+}
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/textarea-maxlength.html b/LayoutTests/fast/forms/textarea-maxlength.html
index 8730a85..bf659c0 100644
--- a/LayoutTests/fast/forms/textarea-maxlength.html
+++ b/LayoutTests/fast/forms/textarea-maxlength.html
@@ -6,7 +6,161 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/textarea-maxlength.js"></script>
+<script>
+description('Tests for HTMLTextAreaElement.maxLength behaviors.');
+
+var textArea = document.createElement('textarea');
+document.body.appendChild(textArea);
+
+// No maxlength attribute
+shouldBe('textArea.maxLength', '-1');
+
+// Invalid maxlength attributes
+textArea.setAttribute('maxlength', '-3');
+shouldBe('textArea.maxLength', '-1');
+textArea.setAttribute('maxlength', 'xyz');
+shouldBe('textArea.maxLength', '-1');
+
+// Valid maxlength attributes
+textArea.setAttribute('maxlength', '1');
+shouldBe('textArea.maxLength', '1');
+textArea.setAttribute('maxlength', '256');
+shouldBe('textArea.maxLength', '256');
+
+// Set values to .maxLength
+textArea.maxLength = 13;
+shouldBe('textArea.getAttribute("maxlength")', '"13"');
+
+shouldThrow('textArea.maxLength = -1', '"Error: INDEX_SIZE_ERR: DOM Exception 1"');
+shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed
+
+textArea.maxLength = null;
+shouldBe('textArea.maxLength', '0');
+shouldBe('textArea.getAttribute("maxlength")', '"0"');
+
+// maxLength doesn't truncate the default value.
+textArea = document.createElement('textarea');
+textArea.setAttribute('maxlength', '3');
+textArea.innerHTML = 'abcd';
+document.body.appendChild(textArea);
+shouldBe('textArea.value', '"abcd"');
+
+// maxLength doesn't truncate .value
+textArea.maxLength = 3;
+textArea.value = 'abcde';
+shouldBe('textArea.value', '"abcde"');
+
+// Set up for user-input tests
+function createFocusedTextAreaWithMaxLength(maxLength) {
+ if (textArea)
+ document.body.removeChild(textArea);
+ textArea = document.createElement('textarea');
+ textArea.setAttribute('maxlength', maxLength);
+ document.body.appendChild(textArea);
+ textArea.focus();
+}
+
+// Insert text of which length is maxLength.
+createFocusedTextAreaWithMaxLength(3);
+document.execCommand('insertText', false, 'abc');
+shouldBe('textArea.value', '"abc"');
+
+// Try to add characters to maxLength characters.
+createFocusedTextAreaWithMaxLength(3);
+textArea.value = 'abc';
+document.execCommand('insertText', false, 'def');
+shouldBe('textArea.value', '"abc"');
+
+// Replace text
+createFocusedTextAreaWithMaxLength(3);
+textArea.value = 'abc';
+document.execCommand('selectAll');
+document.execCommand('insertText', false, 'def');
+shouldBe('textArea.value', '"def"');
+
+// Existing value is longer than maxLength. We can't add text.
+createFocusedTextAreaWithMaxLength(3);
+textArea.value = 'abcdef';
+document.execCommand('insertText', false, 'ghi');
+shouldBe('textArea.value', '"abcdef"');
+
+// We can delete a character in the longer value.
+createFocusedTextAreaWithMaxLength(3);
+textArea.value = 'abcdef';
+document.execCommand('delete');
+shouldBe('textArea.value', '"abcde"');
+
+// A linebreak is 1 character.
+createFocusedTextAreaWithMaxLength(4);
+document.execCommand('insertText', false, 'A');
+document.execCommand('insertLineBreak');
+document.execCommand('insertText', false, 'B');
+shouldBe('textArea.value', '"A\\nB"');
+
+// Confirms correct count for close linebreaks inputs.
+createFocusedTextAreaWithMaxLength(3);
+textArea.innerHTML = 'a\n\n';
+document.execCommand('insertLineBreak');
+shouldBe('textArea.value', '"a\\n\\n"');
+
+// Confirms correct count for open consecutive linebreaks inputs.
+createFocusedTextAreaWithMaxLength(6);
+document.execCommand('insertLineBreak');
+document.execCommand('insertLineBreak');
+document.execCommand('insertLineBreak');
+document.execCommand('insertLineBreak');
+shouldBe('textArea.value', '"\\n\\n\\n"');
+
+// According to the HTML5 specification, maxLength is code-point length.
+// However WebKit handles it as grapheme length.
+
+// fancyX should be treated as 1 grapheme.
+var fancyX = "x\u0305\u0332";// + String.fromCharCode(0x305) + String.fromCharCode(0x332);
+// u10000 is one character consisted of a surrogate pair.
+var u10000 = "\ud800\udc00";
+
+// Inserts 5 code-points in UTF-16
+createFocusedTextAreaWithMaxLength(3);
+document.execCommand('insertText', false, 'AB' + fancyX);
+shouldBe('textArea.value', '"AB" + fancyX');
+shouldBe('textArea.value.length', '5');
+
+createFocusedTextAreaWithMaxLength(3);
+textArea.value = 'AB' + fancyX;
+textArea.setSelectionRange(2, 5); // Select fancyX
+document.execCommand('insertText', false, 'CDE');
+shouldBe('textArea.value', '"ABC"');
+
+// Inserts 4 code-points in UTF-16
+createFocusedTextAreaWithMaxLength(3);
+document.execCommand('insertText', false, 'AB' + u10000);
+shouldBe('textArea.value', '"AB" + u10000');
+shouldBe('textArea.value.length', '4');
+
+createFocusedTextAreaWithMaxLength(3);
+textArea.value = 'AB' + u10000;
+textArea.setSelectionRange(2, 4); // Select u10000
+document.execCommand('insertText', false, 'CDE');
+shouldBe('textArea.value', '"ABC"');
+
+// In the case maxlength=0
+createFocusedTextAreaWithMaxLength(0);
+textArea.value = '';
+document.execCommand('insertText', false, 'ABC');
+shouldBe('textArea.value', '""');
+
+// In the case maxlength=''
+createFocusedTextAreaWithMaxLength('');
+textArea.value = '';
+document.execCommand('insertText', false, 'ABC');
+shouldBe('textArea.value', '"ABC"');
+
+// In the case maxlength='invalid'
+createFocusedTextAreaWithMaxLength('invalid');
+textArea.value = '';
+document.execCommand('insertText', false, 'ABC');
+shouldBe('textArea.value', '"ABC"');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/textarea-metrics.html b/LayoutTests/fast/forms/textarea-metrics.html
index 4e5e248..346870c 100644
--- a/LayoutTests/fast/forms/textarea-metrics.html
+++ b/LayoutTests/fast/forms/textarea-metrics.html
@@ -6,7 +6,164 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/textarea-metrics.js"></script>
+<script>
+description("This test checks that textareas have the right metrics. These numbers match IE7 except for scrollHeight. For two reasons:<br>" +
+"1. scrollHeight is different for elements without enough content to cause scroll because IE7 then reports the height of the text inside the " +
+"element as the scrollHeight. IE8 reports has scrollHeight == offsetHeight. Gecko/WebKit have scrollHeight == clientHeight.<br>" +
+"2. For the elements with scroll in standards-mode, IE wraps the text differently. It seems to leave 2px less space for the text. We don't " +
+"currently mimic this quirk. It's not clear whether we should given that we agree with IE7's clientWidth numbers in all these cases.");
+
+function assertTextareaMetrics(doc, properties, expectedMetrics) {
+ var textarea = doc.createElement('textarea');
+ // Give some consistent CSS for consistent rendering across platforms
+ // and to help in reasoning when trying to match IE metrics.
+ var style = 'overflow-y:auto; font-family:Ahem; line-height:20px; height:50px; width:50px;';
+ var title = '';
+ for (property in properties) {
+ var value = properties[property];
+ title += ' ' + property + ': "' + value + '",';
+ if (property == 'style')
+ style += value;
+ else
+ textarea[property] = value;
+ }
+ textarea.style.cssText = style;
+ doc.body.appendChild(textarea);
+
+ // Create a more human-readable ID.
+ var id = title.replace(/[\'\",;\:]/g, ' ').replace(/ +/g, '-');
+ id = id == '' ? 'no-styles' : id;
+ textarea.id = id;
+
+ window[doc.compatMode + 'doc'] = doc;
+
+ function assertMetricsForTextarea() {
+ if (!title)
+ title = ' none';
+
+ debug('Properties =' + title);
+ shouldBe(doc.compatMode + "doc.getElementById('" + id + "').clientWidth", String(expectedMetrics.clientWidth));
+ shouldBe(doc.compatMode + "doc.getElementById('" + id + "').clientHeight", String(expectedMetrics.clientHeight));
+ shouldBe(doc.compatMode + "doc.getElementById('" + id + "').offsetWidth", String(expectedMetrics.offsetWidth));
+ shouldBe(doc.compatMode + "doc.getElementById('" + id + "').offsetHeight", String(expectedMetrics.offsetHeight));
+ shouldBe(doc.compatMode + "doc.getElementById('" + id + "').scrollWidth", String(expectedMetrics.scrollWidth));
+ shouldBe(doc.compatMode + "doc.getElementById('" + id + "').scrollHeight", String(expectedMetrics.scrollHeight));
+ debug('');
+ }
+ if (document.all)
+ // Give a timeout so IE has time to figure out it's metrics.
+ setTimeout(assertMetricsForTextarea, 100);
+ else
+ assertMetricsForTextarea();
+}
+
+var smallHTML = 'A';
+var htmlThatCausesScroll = 'AAAAAAAAA';
+
+function testTextareasForDocument(doc, compatMode,
+ textareaSizes, textareaWithScrollSizes,
+ textareaWith8pxPaddingSizes, textareaWith8pxPaddingAndScrollbarSizes) {
+ if (doc.compatMode != compatMode)
+ testFailed('This doc should be in ' + compatMode + ' mode.');
+
+ try {
+ var scrollbarStyle = doc.createElement('style');
+ scrollbarStyle.innerText = 'textarea::-webkit-scrollbar{ width:17px }';
+ doc.getElementsByTagName('head')[0].appendChild(scrollbarStyle);
+ } catch (e) {
+ // IE throws an exception here, but doesn't need the above clause anyways.
+ }
+
+ debug('Testing ' + compatMode + ' document.')
+ assertTextareaMetrics(doc, {}, textareaSizes);
+ assertTextareaMetrics(doc, {disabled: true}, textareaSizes);
+ assertTextareaMetrics(doc, {innerHTML: smallHTML}, textareaSizes);
+ assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll}, textareaWithScrollSizes);
+ assertTextareaMetrics(doc, {innerHTML: smallHTML, disabled: true}, textareaSizes);
+ assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll, disabled: true}, textareaWithScrollSizes);
+ assertTextareaMetrics(doc, {innerHTML: smallHTML, style: 'padding:8px'}, textareaWith8pxPaddingSizes);
+ assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll, style: 'padding:8px'}, textareaWith8pxPaddingAndScrollbarSizes);
+ assertTextareaMetrics(doc, {innerHTML: smallHTML, rows: 10}, textareaSizes);
+ assertTextareaMetrics(doc, {innerHTML: htmlThatCausesScroll, rows: 10}, textareaWithScrollSizes);
+}
+
+// For textareas with scrollbars have the expected clientWidth be the
+// expected offsetWidth - scrollbarPlusBorderWidth.
+// default border on textareas is 1px solid. So, the border width is 2.
+// And the scrollbarWidth we set to be 17 to match windows so that
+// these numbers will be platform independent and match IE.
+var scrollbarPlusBorderWidth = 19;
+
+var textareaSizesQuirks = {clientWidth: 48,
+ clientHeight: 48,
+ offsetWidth: 50,
+ offsetHeight: 50,
+ scrollWidth: 48,
+ scrollHeight: 48};
+
+var textareaWithScrollSizesQuirks = {clientWidth: 50 - scrollbarPlusBorderWidth,
+ clientHeight: 48,
+ offsetWidth: 50,
+ offsetHeight: 50,
+ scrollWidth: 50 - scrollbarPlusBorderWidth,
+ scrollHeight: 104};
+
+var textareaWith8pxPaddingSizesQuirks = {clientWidth: 48,
+ clientHeight: 48,
+ offsetWidth: 50,
+ offsetHeight: 50,
+ scrollWidth: 48,
+ scrollHeight: 48};
+
+var textareaWith8pxPaddingAndScrollbarSizesQuirks = {clientWidth: 50 - scrollbarPlusBorderWidth,
+ clientHeight: 48,
+ offsetWidth: 50,
+ offsetHeight: 50,
+ scrollWidth: 50 - scrollbarPlusBorderWidth,
+ scrollHeight: 196};
+
+testTextareasForDocument(document, 'BackCompat',
+ textareaSizesQuirks, textareaWithScrollSizesQuirks,
+ textareaWith8pxPaddingSizesQuirks, textareaWith8pxPaddingAndScrollbarSizesQuirks);
+
+var standardsIframe = document.createElement('iframe');
+standardsIframe.style.width = '100%';
+document.body.appendChild(standardsIframe);
+standardsIframe.contentWindow.document.write('<!DocType html><html><head></head><body></body></html>');
+standardsIframe.contentWindow.document.close();
+
+var textareaSizesStandards = {clientWidth: 54,
+ clientHeight: 54,
+ offsetWidth: 56,
+ offsetHeight: 56,
+ scrollWidth: 54,
+ scrollHeight: 54};
+
+var textareaWithScrollSizesStandards = {clientWidth: 56 - scrollbarPlusBorderWidth,
+ clientHeight: 54,
+ offsetWidth: 56,
+ offsetHeight: 56,
+ scrollWidth: 56 - scrollbarPlusBorderWidth,
+ scrollHeight: 64};
+
+var textareaWith8pxPaddingSizesStandards = {clientWidth: 66,
+ clientHeight: 66,
+ offsetWidth: 68,
+ offsetHeight: 68,
+ scrollWidth: 66,
+ scrollHeight: 66};
+
+var textareaWith8pxPaddingAndScrollbarSizesStandards = {clientWidth: 68 - scrollbarPlusBorderWidth,
+ clientHeight: 66,
+ offsetWidth: 68,
+ offsetHeight: 68,
+ scrollWidth: 68 - scrollbarPlusBorderWidth,
+ scrollHeight: 76};
+
+testTextareasForDocument(standardsIframe.contentWindow.document, 'CSS1Compat',
+ textareaSizesStandards, textareaWithScrollSizesStandards,
+ textareaWith8pxPaddingSizesStandards, textareaWith8pxPaddingAndScrollbarSizesStandards);
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/textarea-placeholder-dom-property.html b/LayoutTests/fast/forms/textarea-placeholder-dom-property.html
index 074ae7c..6f4dc9d 100644
--- a/LayoutTests/fast/forms/textarea-placeholder-dom-property.html
+++ b/LayoutTests/fast/forms/textarea-placeholder-dom-property.html
@@ -6,7 +6,21 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/textarea-placeholder-dom-property.js"></script>
+<script>
+description('Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=21248">https://bugs.webkit.org/show_bug.cgi?id=21248</a>');
+
+var textarea = document.createElement('textarea');
+
+shouldBeEqualToString('textarea.placeholder', '');
+
+textarea.setAttribute('placeholder', 'p1')
+shouldBeEqualToString('textarea.placeholder', 'p1');
+shouldBeEqualToString('textarea.value', '');
+
+textarea.placeholder = 'p2';
+shouldBeEqualToString('textarea.getAttribute("placeholder")', 'p2');
+shouldBeEqualToString('textarea.placeholder', 'p2');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/textarea-rows-cols.html b/LayoutTests/fast/forms/textarea-rows-cols.html
index c081305..7df1402 100644
--- a/LayoutTests/fast/forms/textarea-rows-cols.html
+++ b/LayoutTests/fast/forms/textarea-rows-cols.html
@@ -6,7 +6,124 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/textarea-rows-cols.js"></script>
+<script>
+description('Test for edge cases of <textarea> rows and cols attributes.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<textarea>default</textarea>';
+
+debug('Default values');
+var textarea = parent.firstChild;
+var defaultRows = textarea.rows;
+var defaultCols = textarea.cols;
+var defaultHeight = textarea.offsetHeight;
+var defaultWidth = textarea.offsetWidth;
+shouldBe('defaultRows', '2');
+shouldBe('defaultCols', '20');
+shouldBeTrue('defaultHeight > 0');
+shouldBeTrue('defaultWidth > 0');
+
+debug('rows = 1');
+parent.innerHTML = '<textarea rows="1">rows = 1</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', '1');
+shouldBeTrue('textarea.offsetHeight > 0');
+shouldBeTrue('textarea.offsetHeight < defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('rows = 2; should match default height');
+parent.innerHTML = '<textarea rows="2">rows = 2; should match default height</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', 'defaultRows');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('rows = 3');
+parent.innerHTML = '<textarea rows="3">rows = 3</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', '3');
+shouldBeTrue('textarea.offsetHeight > defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('rows; should be default height');
+parent.innerHTML = '<textarea rows>rows; should be default height</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', 'defaultRows');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('rows = 0; should be default height');
+parent.innerHTML = '<textarea rows="0">rows = 0; should be default height</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', 'defaultRows');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('rows = -1; should be default height');
+parent.innerHTML = '<textarea rows="-1">rows = -1; should be default height</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', 'defaultRows');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('rows = x; should be default height');
+parent.innerHTML = '<textarea rows="x">rows = x; should be default height</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.rows', 'defaultRows');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+
+debug('cols = 1');
+parent.innerHTML = '<textarea cols="1">cols = 1</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', '1');
+shouldBeTrue('textarea.offsetWidth > 0');
+shouldBeTrue('textarea.offsetWidth < defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+
+debug('cols = 20; should match default width');
+parent.innerHTML = '<textarea cols="20">cols = 20; should match default width</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', 'defaultCols');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+
+debug('cols = 40');
+parent.innerHTML = '<textarea cols="40">cols = 40</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', '40');
+shouldBeTrue('textarea.offsetWidth > defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+
+debug('cols; should be default width');
+parent.innerHTML = '<textarea cols>cols; should be default width</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', 'defaultCols');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+
+debug('cols = 0; should be default width');
+parent.innerHTML = '<textarea cols="0">cols = 0; should be default width</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', 'defaultCols');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+
+debug('cols = -1; should be default width');
+parent.innerHTML = '<textarea cols="-1">cols = -1; should be default width</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', 'defaultCols');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+
+debug('cols = x; should be default width');
+parent.innerHTML = '<textarea cols="x">cols = x; should be default width</textarea>';
+textarea = parent.firstChild;
+shouldBe('textarea.cols', 'defaultCols');
+shouldBe('textarea.offsetWidth', 'defaultWidth');
+shouldBe('textarea.offsetHeight', 'defaultHeight');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/textarea-textlength.html b/LayoutTests/fast/forms/textarea-textlength.html
index 8817c4f..5a8a693 100644
--- a/LayoutTests/fast/forms/textarea-textlength.html
+++ b/LayoutTests/fast/forms/textarea-textlength.html
@@ -6,7 +6,36 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/textarea-textlength.js"></script>
+<script>
+description('Test for HTMLTextAreaElement.textLength');
+
+var textArea = document.createElement('textarea');
+document.body.appendChild(textArea);
+shouldBe('textArea.textLength', '0');
+
+textArea.value = 'abcd';
+shouldBe('textArea.textLength', '4');
+
+textArea.focus();
+eventSender.keyDown('e', []);
+shouldBe('textArea.textLength', '5');
+
+// Test for a character larger than U+FFFF.
+textArea = document.createElement('textarea');
+textArea.innerHTML = '𝔸';
+// Firefox 3.5 and Opera 10 return 2 for 1 surrogate pair.
+shouldBe('textArea.textLength', '2');
+
+// Test for combined characters.
+textArea = document.createElement('textarea');
+// U+3055 Hiragana Letter Sa
+// U+3099 Combining Katakana-HIragana Voiced Sound Mark
+textArea.innerHTML = 'ざ';
+// Firefox 3.5 seems to apply NFC for the value, and .textLength and .value.length is 1.
+// Opera 10 returns 2, and IE's .value.length is 2.
+shouldBe('textArea.textLength', '2');
+
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/validationMessage.html b/LayoutTests/fast/forms/validationMessage.html
index 64e9322..f6eb0bb 100644
--- a/LayoutTests/fast/forms/validationMessage.html
+++ b/LayoutTests/fast/forms/validationMessage.html
@@ -6,7 +6,89 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/validationMessage.js"></script>
+<script>
+description("Test for validationMessage DOM property.");
+
+var form = document.createElement("form");
+
+// An input element with a pattern set and a mismatched value
+var patternInput = document.createElement("input");
+patternInput.name = "patternInput";
+patternInput.pattern = "lorem ipsum";
+patternInput.value = "lorem";
+form.appendChild(patternInput);
+shouldBe("patternInput.validationMessage", "'pattern mismatch'");
+
+// A required input with an empty value
+var requiredInput = document.createElement("input");
+requiredInput.name = "requiredInput";
+requiredInput.required = true;
+form.appendChild(requiredInput);
+shouldBe("requiredInput.validationMessage", "'value missing'");
+
+// A required textarea with an empty value
+var requiredTextArea = document.createElement("textarea");
+requiredTextArea.name = "requiredTextArea";
+requiredTextArea.required = true;
+form.appendChild(requiredTextArea);
+shouldBe("requiredTextArea.validationMessage", "'value missing'");
+
+// A required select with an empty value
+var requiredSelect = document.createElement("select");
+requiredSelect.name = "requiredSelect";
+requiredSelect.required = true;
+form.appendChild(requiredSelect);
+shouldBe("requiredSelect.validationMessage", "'value missing'");
+
+// A type=email input for the "type mismatch" flag
+var emailInput = document.createElement("input");
+emailInput.name = "emailInput";
+emailInput.type = "email";
+emailInput.value = "incorrectValue";
+form.appendChild(emailInput);
+shouldBe("emailInput.validationMessage", "'type mismatch'");
+
+// A button can't be valited and, thus, has a blank validationMessage
+var but = document.createElement("button");
+but.name = "button";
+form.appendChild(but);
+shouldBe("but.validationMessage", "''");
+
+// An input control with no name, so it can't be validated (willValidate = false)
+var anoninput = document.createElement("input");
+form.appendChild(anoninput);
+shouldBe("anoninput.validationMessage", "''")
+
+// Fieldsets can't be validated
+var happyFieldset = document.createElement("fieldset");
+happyFieldset.name = "fieldset";
+form.appendChild(happyFieldset);
+shouldBe("happyFieldset.validationMessage", "''");
+
+// Select controls can't be validated too
+var happySelect = document.createElement("select");
+happySelect.name = "select";
+form.appendChild(happySelect);
+shouldBe("happySelect.validationMessage", "''");
+
+// Output elements can't be validated
+var happyOutput = document.createElement("output");
+happySelect.name = "output";
+form.appendChild(happyOutput);
+shouldBe("happyOutput.validationMessage", "''");
+
+// Object elements can't be validated
+var happyObject = document.createElement("object");
+happySelect.name = "object";
+form.appendChild(happyObject);
+shouldBe("happyObject.validationMessage", "''");
+
+// Keygen controls can't be validated
+var happyKeygen = document.createElement("keygen");
+happySelect.name = "keygen";
+form.appendChild(happyKeygen);
+shouldBe("happyKeygen.validationMessage", "''");
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/forms/willvalidate.html b/LayoutTests/fast/forms/willvalidate.html
index eef71be..5fcf17a 100644
--- a/LayoutTests/fast/forms/willvalidate.html
+++ b/LayoutTests/fast/forms/willvalidate.html
@@ -6,7 +6,92 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/willvalidate.js"></script>
+<script>
+description('Various tests for .willValidate property');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+
+debug('Existence of .willValidate');
+parent.innerHTML = '<form>'
+ + '<input name="victim"/>'
+ + '<textarea name="victim"></textarea>'
+ + '<fieldset name="victim">Test</fieldset>'
+ + '<button name="victim">'
+ + '<select name="victim"></select>'
+ + '<output name="victim"></output>'
+ + '<object name="victim"></object>'
+ + '<keygen name="victim">'
+ + '</form>';
+var controls = document.getElementsByName('victim');
+ for (var i = 0; i < controls.length; i++)
+ shouldBe('typeof controls[i].willValidate', '"boolean"');
+
+debug('');
+debug('Form association');
+parent.innerHTML = '<input name="test">';
+var input = document.getElementsByTagName("input")[0];
+shouldBeTrue('input.willValidate');
+parent.innerHTML = '<form><input name="test"></form>';
+input = document.getElementsByTagName("input")[0];
+shouldBeTrue('input.willValidate');
+
+debug('');
+debug('Control name');
+parent.innerHTML = '<form><input></form>';
+input = document.getElementsByTagName("input")[0];
+shouldBeTrue('input.willValidate');
+parent.innerHTML = '<form><input name="test"></form>';
+input = document.getElementsByTagName("input")[0];
+shouldBeTrue('input.willValidate');
+
+debug('');
+debug('Disabled control');
+parent.innerHTML = '<form><input name="test" disabled></form>';
+input = document.getElementsByTagName("input")[0];
+shouldBeFalse('input.willValidate');
+
+debug('');
+debug('Read-only control');
+parent.innerHTML = '<form><input name="test" readonly></form>';
+input = document.getElementsByTagName("input")[0];
+shouldBeFalse('input.willValidate');
+
+debug('');
+debug('Input types');
+parent.innerHTML = '<form><input name="test"></form>';
+input = document.getElementsByTagName("input")[0];
+shouldBeTrue('input.willValidate');
+shouldBeFalse('input.type = "button"; input.willValidate');
+shouldBeTrue('input.type = "submit"; input.willValidate');
+shouldBeFalse('input.type = "hidden"; input.willValidate');
+shouldBeFalse('input.type = "reset"; input.willValidate');
+
+debug('');
+debug('Fieldset element');
+parent.innerHTML = '<form><fieldset><p>Fieldset test</p></fieldtset></form>';
+shouldBeFalse('document.getElementsByTagName("fieldset")[0].willValidate');
+
+debug('');
+debug('Textarea element');
+parent.innerHTML = '<form><textarea name="text"></textarea></form>';
+shouldBeTrue('document.getElementsByTagName("textarea")[0].willValidate');
+
+debug('');
+debug('Output element');
+parent.innerHTML = '<form><output></output></form>';
+shouldBeFalse('document.getElementsByTagName("output")[0].willValidate');
+
+debug('');
+debug('Object element');
+parent.innerHTML = '<form><object></object></form>';
+shouldBeFalse('document.getElementsByTagName("object")[0].willValidate');
+
+debug('');
+debug('Keygen element');
+parent.innerHTML = '<form><keygen></form>';
+shouldBeFalse('document.getElementsByTagName("keygen")[0].willValidate');
+</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>