4 document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
7 function appendChildText(node, text)
9 if (node.canHaveChildren == null || node.canHaveChildren) {
10 node.appendChild(document.createTextNode(text));
12 // IE doesn't allow script nodes to have children. We must use the
13 // .text property instead.
18 function createScriptElement(type, language)
20 var script = document.createElement('script');
24 typeStr = 'unspecified';
26 typeStr = '\\"' + type + '\\"';
27 script.setAttribute('type', type);
31 if (language == null) {
32 languageStr = 'unspecified';
34 languageStr = '\\"' + language + '\\"';
35 script.setAttribute('language', language);
38 var text = 'log("Type: ' + typeStr + ', Language: ' + languageStr + '");';
39 appendChildText(script, text);
46 if (window.layoutTestController)
47 layoutTestController.dumpAsText();
54 "application/javascript",
55 "application/ecmascript",
56 "application/x-javascript",
101 for (var i = 0; i < types.length; ++i)
102 document.body.appendChild(createScriptElement(types[i], null));
104 for (var i = 0; i < languages.length; ++i)
105 document.body.appendChild(createScriptElement(null, languages[i]));
107 for (var i = 0; i < languages.length; ++i)
108 document.body.appendChild(createScriptElement("", languages[i]));
110 log('When a type is specified, the language attribute should be ignored.');
111 for (var i = 0; i < languages.length; ++i)
112 document.body.appendChild(createScriptElement("text/javascript", languages[i]));
115 <body onload="test();">
116 <p>This page tests the allowed values for the type and language attributes
117 of the <script> tag. Below you will see the allowed values.</p>