| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 description("Using document.register() for extending HTML and non-HTML elements.
"); | 8 description("Using document.register() for extending HTML and non-HTML elements.
"); |
| 9 | 9 |
| 10 document.register = document.register || document.webkitRegister; | 10 document.register = document.register || document.webkitRegister; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 var svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg-foo"); | 46 var svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg-foo"); |
| 47 shouldBe("svg2.tagName", "'svg-foo'"); | 47 shouldBe("svg2.tagName", "'svg-foo'"); |
| 48 shouldBe("svg2.namespaceURI", "'http://www.w3.org/2000/svg'"); | 48 shouldBe("svg2.namespaceURI", "'http://www.w3.org/2000/svg'"); |
| 49 var svg3 = createElementFromSVG("<svg-foo></svg-foo>"); | 49 var svg3 = createElementFromSVG("<svg-foo></svg-foo>"); |
| 50 shouldBe("svg3.tagName", "'svg-foo'"); | 50 shouldBe("svg3.tagName", "'svg-foo'"); |
| 51 shouldBe("svg3.namespaceURI", "'http://www.w3.org/2000/svg'"); | 51 shouldBe("svg3.namespaceURI", "'http://www.w3.org/2000/svg'"); |
| 52 | 52 |
| 53 var notSVG1 = document.createElement("svg-foo"); | 53 var notSVG1 = document.createElement("svg-foo"); |
| 54 shouldBe("notSVG1.namespaceURI", "'http://www.w3.org/1999/xhtml'"); | 54 shouldBe("notSVG1.namespaceURI", "'http://www.w3.org/1999/xhtml'"); |
| 55 shouldBeFalse("notSVG1 instanceof CustomSVGElement"); | 55 shouldBeFalse("notSVG1 instanceof CustomSVGElement"); |
| 56 shouldBeTrue("notSVG1 instanceof HTMLUnknownElement"); | 56 shouldBeFalse("notSVG1 instanceof HTMLUnknownElement"); |
| 57 shouldBeTrue("notSVG1 instanceof HTMLElement"); |
| 58 shouldBe("Object.getPrototypeOf(notSVG1)", "HTMLElement.prototype"); |
| 57 var notSVG2 = createElementFromHTML("<svg-foo></svg-foo>"); | 59 var notSVG2 = createElementFromHTML("<svg-foo></svg-foo>"); |
| 58 shouldBe("notSVG2.namespaceURI", "'http://www.w3.org/1999/xhtml'"); | 60 shouldBe("notSVG2.namespaceURI", "'http://www.w3.org/1999/xhtml'"); |
| 59 shouldBeFalse("notSVG2 instanceof CustomSVGElement"); | 61 shouldBeFalse("notSVG2 instanceof CustomSVGElement"); |
| 60 shouldBeTrue("notSVG2 instanceof HTMLUnknownElement"); | 62 shouldBeFalse("notSVG2 instanceof HTMLUnknownElement"); |
| 63 shouldBeTrue("notSVG2 instanceof HTMLElement"); |
| 64 shouldBe("Object.getPrototypeOf(notSVG2)", "HTMLElement.prototype"); |
| 61 | 65 |
| 62 // Trying to extend something outside HTML or SVG should throw a NAMESPACE_ERR | 66 // Trying to extend something outside HTML or SVG should throw a NAMESPACE_ERR |
| 63 shouldThrow( | 67 shouldThrow( |
| 64 "document.register('xml-foo', { prototype: Object.create(Element.prototype)
})", | 68 "document.register('xml-foo', { prototype: Object.create(Element.prototype)
})", |
| 65 "'Error: NamespaceError: DOM Exception 14'"); | 69 "'Error: NamespaceError: DOM Exception 14'"); |
| 66 | 70 |
| 67 </script> | 71 </script> |
| 68 <script src="../../js/resources/js-test-post.js"></script> | 72 <script src="../../js/resources/js-test-post.js"></script> |
| 69 </body> | 73 </body> |
| 70 </html> | 74 </html> |
| OLD | NEW |