Regression(r206240): XMLSerializer.serializeToString() does not properly escape ...
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / domparsing / outerhtml-02.html
1 <!DOCTYPE html>
2 <title>outerHTML and string conversion</title>
3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
4 <link rel="help" href="http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface">
5 <script src="../../../../resources/testharness.js"></script>
6 <script src="../../../../resources/testharnessreport.js"></script>
7 <div id="log"></div>
8 <script>
9 test(function() {
10   var div = document.createElement("div");
11   var p = div.appendChild(document.createElement("p"));
12   p.outerHTML = null;
13   assert_equals(div.innerHTML, "");
14   assert_equals(div.textContent, "");
15 }, "outerHTML and string conversion: null.")
16
17 test(function() {
18   var div = document.createElement("div");
19   var p = div.appendChild(document.createElement("p"));
20   p.outerHTML = undefined;
21   assert_equals(div.innerHTML, "undefined");
22   assert_equals(div.textContent, "undefined");
23 }, "outerHTML and string conversion: undefined.")
24
25 test(function() {
26   var div = document.createElement("div");
27   var p = div.appendChild(document.createElement("p"));
28   p.outerHTML = 42;
29   assert_equals(div.innerHTML, "42");
30   assert_equals(div.textContent, "42");
31 }, "outerHTML and string conversion: number.")
32
33 test(function() {
34   var div = document.createElement("div");
35   var p = div.appendChild(document.createElement("p"));
36   p.outerHTML = {
37     toString: function() { return "pass"; },
38     valueOf: function() { return "fail"; }
39   };
40   assert_equals(div.innerHTML, "pass");
41   assert_equals(div.textContent, "pass");
42 }, "outerHTML and string conversion: toString.")
43
44 test(function() {
45   var div = document.createElement("div");
46   var p = div.appendChild(document.createElement("p"));
47   p.outerHTML = {
48     toString: undefined,
49     valueOf: function() { return "pass"; }
50   };
51   assert_equals(div.innerHTML, "pass");
52   assert_equals(div.textContent, "pass");
53 }, "outerHTML and string conversion: valueOf.")
54 </script>