blob: 5ea23ba3b642a5b6480c07df461ec4113ddc4f01 (
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
35
36
37
|
<!DOCTYPE html>
<html>
<body>
<fieldset id="outer">
<fieldset id="inner">
</fieldset>
</fieldset>
</body>
</html>
<script>
function appendTextareaToFieldset(fieldset) {
var textarea = document.createElement("textarea");
textarea.setAttribute("required", "");
fieldset.appendChild(textarea);
}
var innerFieldset = document.getElementById('inner');
var outerFieldset = document.getElementById('outer');
var fieldset = document.createElement('fieldset');
appendTextareaToFieldset(fieldset);
appendTextareaToFieldset(fieldset);
appendTextareaToFieldset(fieldset);
appendTextareaToFieldset(fieldset);
// Adding a fieldset to a nested fieldset.
innerFieldset.appendChild(fieldset);
appendTextareaToFieldset(fieldset);
appendTextareaToFieldset(fieldset);
// This triggers mInvalidElementsCount checks in outer fieldset.
appendTextareaToFieldset(outerFieldset);
// Removing a fieldset from a nested fieldset.
innerFieldset.removeChild(fieldset);
// This triggers mInvalidElementsCount checks in outer fieldset.
appendTextareaToFieldset(outerFieldset);
</script>
|