File: mutate.html

package info (click to toggle)
itsalltext 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 932 kB
  • ctags: 177
  • sloc: makefile: 134
file content (62 lines) | stat: -rw-r--r-- 1,627 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Mutating HTML</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    <style type="text/css">
    #test {
      text-align: center;
    }
    </style>
  </head>

  <body>
    <h1>Mutating HTML</h1>

    <div class="back"><a href=".">back</a></div>

    <p>
      Purpose: to verify IAT! works even with dynamically created HTML.
    </p>

    <div id="test" style="height: 8em">
      The textareas should appear here.
    </div>
    
    <ol>
      <li>
        Click here: <a href="#" onclick="iat.make()">create textarea</a>.
        A Textarea should appear above.
      </li>
      <li>
        Verify that the edit button appears when you hover over the textarea.
      </li>
      <li>
        Click edit, make a change, save; the textarea should update.
      </li>
    </ol>

    <div class="back"><a href=".">back</a></div>
    <script type="text/javascript">
    var iat = (function () {
    return {
        parent_id: 'test',
        counter: 0,
        make: function () {
            var parent = document.getElementById(this.parent_id);
            while (parent.hasChildNodes()) {
                parent.removeChild(parent.firstChild);
            }
            var ta = document.createElement('textarea');
            ta.id = 'textarea-' + this.counter;
            ta.value = 'Textarea ' + this.counter;
            this.counter++;
            parent.appendChild(ta);
        }
    };
    })();
    </script>
  </body>
</html>