summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-textarea-element/cloning-steps.html
blob: 7a85bd26a1f273519a51f534acad13fdc05996c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<meta charset="utf-8">
<title>Cloning of textarea elements</title>
<link rel="help" href="https://dom.spec.whatwg.org/#dom-node-clonenode">
<link rel="help" href="https://dom.spec.whatwg.org/#concept-node-clone">
<link rel="help" href="https://dom.spec.whatwg.org/#concept-node-clone-ext">
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-node-clone-ext">
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
"use strict";

test(function() {
  var textarea = document.createElement("textarea");
  textarea.value = "foo bar";

  var copy = textarea.cloneNode();
  assert_equals(copy.value, "foo bar");
}, "textarea element's value should be cloned");

test(function() {
  var textarea = document.createElement("textarea");
  textarea.value = "foo bar";

  var copy = textarea.cloneNode();
  copy.setAttribute("value", "something else");

  assert_equals(copy.value, "foo bar");
}, "textarea element's dirty value flag should be cloned, so setAttribute doesn't affect the cloned textarea's value");

</script>