Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / set-outer-html.html
blobd8bc157f4a088df18d82a6c5b77590af4ceda6eb
1 <html>
2 <head>
3 <style>
4 pre { margin: 0; }
5 </style>
6 <script src="../../resources/dump-as-markup.js"></script>
7 <script>
8 Markup.noAutoDump();
10 function assertMarkup(name, element, expected)
12 var markup = Markup.get(element);
13 if (markup == expected)
14 log('PASS: ' + name);
15 else
16 log('FAIL: ' + name + '\nWas:\n' + markup + '\nExpected:\n' + expected);
19 function log(text)
21 var el = document.createElement('pre');
22 el.appendChild(document.createTextNode(text));
23 document.getElementById('result').appendChild(el);
26 function runTest()
28 if (window.testRunner)
29 testRunner.dumpAsText()
31 var items = document.getElementsByTagName('li');
32 document.getElementById('testReplace').outerHTML = '<span>Replaced</span> node';
33 assertMarkup('replace', items[0], '| <span>\n| "Replaced"\n| " node using outerHTML."');
35 document.getElementById('testRemove').outerHTML = '';
36 assertMarkup('remove', items[1], '| " removing node using outerHTML."');
38 document.getElementById('testMerge').outerHTML = 'merging';
39 assertMarkup('merge text nodes', items[2], '| "Testing merging text nodes."');
41 document.getElementById('testAddBr').outerHTML = '<br>';
42 assertMarkup('line break', items[3], '| "Testing adding "\n| <br>\n| " using outerHTML."');
44 </script>
45 </head>
46 <body onload="runTest()">
47 <ul>
48 <li><span id="testReplace">Testing replacing node</span> using outerHTML.</li>
49 <li><span id="testRemove">Testing</span> removing node using outerHTML.</li>
50 <li>Testing <span id="testMerge">merging</span> text nodes.</li>
51 <li>Testing adding <span id="testAddBr">line break</span> using outerHTML.</li>
52 </ul>
53 <div id="result"></div>
54 </body>
55 </html>