Regression(r206240): XMLSerializer.serializeToString() does not properly escape ...
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / domparsing / innerhtml-07.html
1 <!DOCTYPE html>
2 <title>innerHTML 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 p = document.createElement("p");
11   p.innerHTML = null;
12   assert_equals(p.innerHTML, "");
13   assert_equals(p.textContent, "");
14 }, "innerHTML and string conversion: null.")
15
16 test(function() {
17   var p = document.createElement("p");
18   p.innerHTML = undefined;
19   assert_equals(p.innerHTML, "undefined");
20   assert_equals(p.textContent, "undefined");
21 }, "innerHTML and string conversion: undefined.")
22
23 test(function() {
24   var p = document.createElement("p");
25   p.innerHTML = 42;
26   assert_equals(p.innerHTML, "42");
27   assert_equals(p.textContent, "42");
28 }, "innerHTML and string conversion: number.")
29
30 test(function() {
31   var p = document.createElement("p");
32   p.innerHTML = {
33     toString: function() { return "pass"; },
34     valueOf: function() { return "fail"; }
35   };
36   assert_equals(p.innerHTML, "pass");
37   assert_equals(p.textContent, "pass");
38 }, "innerHTML and string conversion: toString.")
39
40 test(function() {
41   var p = document.createElement("p");
42   p.innerHTML = {
43     toString: undefined,
44     valueOf: function() { return "pass"; }
45   };
46   assert_equals(p.innerHTML, "pass");
47   assert_equals(p.textContent, "pass");
48 }, "innerHTML and string conversion: valueOf.")
49 </script>