6 <script src=
"../../resources/dump-as-markup.js"></script>
10 function assertMarkup(name
, element
, expected
)
12 var markup
= Markup
.get(element
);
13 if (markup
== expected
)
16 log('FAIL: ' + name
+ '\nWas:\n' + markup
+ '\nExpected:\n' + expected
);
21 var el
= document
.createElement('pre');
22 el
.appendChild(document
.createTextNode(text
));
23 document
.getElementById('result').appendChild(el
);
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."');
46 <body onload=
"runTest()">
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>
53 <div id=
"result"></div>