OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head> |
| 4 <script src="../js/resources/js-test-pre.js"></script> |
| 5 <style> |
| 6 </style> |
| 7 </head> |
| 8 <body> |
| 9 <svg xmlns="http://www.w3.org/2000/svg"></svg> |
| 10 <bar xmlns="http://test/foo"></bar> |
| 11 <script> |
| 12 description("Test innerHTML in XHTML/XML documents"); |
| 13 |
| 14 var namespaces = [ |
| 15 "http://www.w3.org/2000/svg", |
| 16 "http://test/foo" |
| 17 ]; |
| 18 var elementnames = [ |
| 19 "svg", |
| 20 "bar" |
| 21 ]; |
| 22 var texts = [ |
| 23 "<g/>", |
| 24 "<body></body>" |
| 25 |
| 26 ]; |
| 27 |
| 28 var element, childns; |
| 29 function g(ns, elementName, text, appendOrSelect) { |
| 30 if (appendOrSelect == "append") { |
| 31 element = document.createElementNS(ns, elementName); |
| 32 document.body.appendChild(element); |
| 33 childns = ns; |
| 34 } else { |
| 35 element = document.querySelector(elementName); |
| 36 childns = element.namespaceURI; |
| 37 } |
| 38 element.innerHTML = text; |
| 39 shouldBeEqualToString("element.firstChild.namespaceURI", childns); |
| 40 } |
| 41 |
| 42 namespaces.forEach(function(ns) { |
| 43 elementnames.forEach(function(elementname) { |
| 44 texts.forEach(function(text) { |
| 45 g(ns, elementname, text, "append"); |
| 46 g(ns, elementname, text, "select"); |
| 47 }); |
| 48 }); |
| 49 }); |
| 50 </script> |
| 51 <script src="../js/resources/js-test-post.js"></script> |
| 52 </body> |
| 53 </html> |
OLD | NEW |