OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 window.onload = function() | 4 window.onload = function() |
5 { | 5 { |
6 if (window.testRunner) { | 6 if (window.testRunner) { |
7 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
8 } | 8 } |
9 | 9 |
10 function alertMsg(msg) { | 10 function alertMsg(msg) { |
11 return "javascript:alert(\"FAIL: " + msg + | 11 return "javascript:alert(\"FAIL: " + msg + |
12 "\");document.body.innerHTML=\"<p style='font-weight:bold;color:red'
>Failure testing " + msg + "</p>\";//"; | 12 "\");document.body.innerHTML=\"<p style='font-weight:bold;color:red'
>Failure testing " + msg + "</p>\";//"; |
13 } | 13 } |
14 // Test different ways of setting iframe.src | 14 // Test different ways of setting iframe.src |
15 var aliasTests = [ | 15 var aliasTests = [ |
16 // Attr/Node attributes | 16 // Attr/Node attributes |
17 function(iFrame) { iFrame.attributes['src'].value = alertMsg("value"); i
Frame.src = iFrame.src;}, | 17 function(iFrame) { iFrame.attributes['src'].value = alertMsg("value"); i
Frame.src = iFrame.src;}, |
18 | 18 |
19 // Text Node Manipulation | 19 // Text Node Manipulation |
20 function(iFrame) { iFrame.attributes['src'].firstChild.data = alertMsg("
nodeValue");}, | 20 function(iFrame) { iFrame.attributes['src'].firstChild.data = alertMsg("
nodeValue");}, |
21 | 21 |
22 // Node attribute manipulation functions | 22 // Node attribute manipulation functions |
23 function(iFrame) { iFrame.setAttribute("src", alertMsg("setAttribute"));
}, | 23 function(iFrame) { iFrame.setAttribute("src", alertMsg("setAttribute"));
}, |
24 function(iFrame) { iFrame.setAttributeNS(null, "src", alertMsg("setAttri
buteNS"));}, | 24 function(iFrame) { iFrame.setAttributeNS(null, "src", alertMsg("setAttri
buteNS"));}, |
25 function(iFrame) { | 25 function(iFrame) { |
26 var a = document.createAttribute('src'); | 26 var a = document.createAttribute('src'); |
27 a.value = alertMsg("setAttributeNode"); | 27 a.value = alertMsg("setAttributeNode"); |
28 iFrame.setAttributeNode(a); | 28 iFrame.setAttributeNode(a); |
29 }, | 29 }, |
| 30 function(iFrame) { |
| 31 var a = document.createAttribute('src'); |
| 32 a.nodeValue = alertMsg("setAttributeNodeNS"); |
| 33 iFrame.setAttributeNodeNS(a); |
| 34 }, |
30 // Child manipulation methods | 35 // Child manipulation methods |
31 function(iFrame) { | 36 function(iFrame) { |
32 var src = iFrame.attributes['src']; | 37 var src = iFrame.attributes['src']; |
33 src.appendChild(document.createTextNode(alertMsg("appendChild() + re
moveChild()"))); | 38 src.appendChild(document.createTextNode(alertMsg("appendChild() + re
moveChild()"))); |
34 src.removeChild(src.firstChild); | 39 src.removeChild(src.firstChild); |
35 }, | 40 }, |
36 function(iFrame) { | 41 function(iFrame) { |
37 var src = iFrame.attributes['src']; | 42 var src = iFrame.attributes['src']; |
38 src.replaceChild(document.createTextNode(alertMsg("replaceChild()"))
, src.firstChild); | 43 src.replaceChild(document.createTextNode(alertMsg("replaceChild()"))
, src.firstChild); |
39 }, | 44 }, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 94 } |
90 | 95 |
91 </script> | 96 </script> |
92 </head> | 97 </head> |
93 <body> | 98 <body> |
94 <p>This script tests if iframe.src can be set to a JavaScript URL via alternate | 99 <p>This script tests if iframe.src can be set to a JavaScript URL via alternate |
95 DOM interfaces (such as Node.textContent or NamedNode.setNamedItem). | 100 DOM interfaces (such as Node.textContent or NamedNode.setNamedItem). |
96 The test is successful if no alerts appear and the page finishes loading.</p> | 101 The test is successful if no alerts appear and the page finishes loading.</p> |
97 </body> | 102 </body> |
98 </html> | 103 </html> |
OLD | NEW |