5 function addTextarea(properties
, opt_innerHTML
) {
6 var title
= docToAppendTo
.createTextNode('');
8 var wrapper
= docToAppendTo
.createElement('div');
9 wrapper
.style
.cssText
= 'display:inline-block;border:1px solid blue;font-size:12px;';
10 var textarea
= docToAppendTo
.createElement('textarea');
11 for (property
in properties
) {
12 var value
= properties
[property
];
13 title
.nodeValue
+= property
+ ': "' + value
+ '", ';
14 if (property
== 'wrap')
15 textarea
.setAttribute(property
, value
);
16 else if (property
== 'style')
17 textarea
.style
.cssText
= value
;
19 textarea
[property
] = value
;
21 textarea
.innerHTML
= opt_innerHTML
||
22 "Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv";
24 var span
= document
.createElement('span');
25 span
.style
.cssText
= 'display:inline-block;width:80px;';
26 span
.appendChild(title
);
27 wrapper
.appendChild(span
);
28 wrapper
.appendChild(document
.createElement('br'));
29 wrapper
.appendChild(textarea
)
30 docToAppendTo
.body
.appendChild(wrapper
);
33 function addAllTextareas(iframe
, compatMode
) {
34 iframe
.style
.cssText
= 'width:100%;border:0;'
35 docToAppendTo
= iframe
.contentWindow
.document
;
37 docToAppendTo
.body
.style
.cssText
= 'margin:0';
39 if (docToAppendTo
.compatMode
!= compatMode
)
40 testFailed('This document should be in ' + compatMode
+ ' mode.');
42 var compatModeTitle
= docToAppendTo
.createElement('div');
43 compatModeTitle
.innerHTML
= 'CompatMode: ' + docToAppendTo
.compatMode
;
44 compatModeTitle
.style
.cssText
= 'margin:5px 0;font-weight:bold;';
45 docToAppendTo
.body
.appendChild(compatModeTitle
);
47 addTextarea({}, 'Lorem ipsum dolor');
48 addTextarea({disabled
: 'true'});
49 addTextarea({style
: 'padding:10px'});
50 addTextarea({style
: 'padding:0px'});
51 addTextarea({style
: 'margin:10px'});
52 addTextarea({style
: 'margin:0px'});
53 addTextarea({style
: 'width:60px'});
54 addTextarea({style
: 'width:60px; padding:20px'});
55 addTextarea({style
: 'width:60px; padding:0'});
56 addTextarea({style
: 'height:60px'});
57 addTextarea({style
: 'width:60px; height:60px'});
58 addTextarea({style
: 'overflow:hidden'});
59 addTextarea({style
: 'overflow:scroll'});
60 addTextarea({style
: 'overflow:hidden; width:60px; height:60px'});
61 addTextarea({style
: 'overflow:scroll; width:60px; height:60px'});
62 addTextarea({cols
: 5, style
: 'width:60px; height:60px'});
63 addTextarea({rows
: 4, style
: 'width:60px; height:60px'});
64 addTextarea({cols
: 5, rows
: 4, style
: 'width:60px; height:60px'});
65 addTextarea({cols
: 3});
66 addTextarea({rows
: 3});
67 addTextarea({cols
: 7});
68 addTextarea({rows
: 7});
69 addTextarea({cols
: 5, rows
: 4});
70 addTextarea({wrap
: 'off'});
71 addTextarea({wrap
: 'hard'});
72 addTextarea({wrap
: 'soft'});
73 addTextarea({style
: 'white-space:normal'});
74 addTextarea({style
: 'white-space:pre'});
75 addTextarea({style
: 'white-space:prewrap'});
76 addTextarea({style
: 'white-space:nowrap'});
77 addTextarea({style
: 'white-space:pre-line'});
78 addTextarea({style
: 'word-wrap:normal'});
79 addTextarea({wrap
: 'off', style
: 'white-space:pre-wrap'});
81 iframe
.style
.height
= docToAppendTo
.body
.offsetHeight
+ 5 + 'px';
84 document
.body
.style
.margin
= 0;
86 var standardsIframe
= document
.createElement('iframe');
87 // Reference a page with a doctype so it's standards mode.
88 standardsIframe
.src
= 'resources/basic-textareas-standards.html';
89 standardsIframe
.onload = function(e
) {
90 addAllTextareas(e
.target
, 'CSS1Compat');
92 document
.body
.appendChild(standardsIframe
);
94 var quirksIframe
= document
.createElement('iframe');
95 quirksIframe
.onload = function(e
) {
96 addAllTextareas(e
.target
, 'BackCompat');
98 document
.body
.appendChild(quirksIframe
);