OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Custom element constructor sets local namespace to the namespace from cus
tom element definition</title> |
| 5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| 6 <meta name="assert" content="Custom element constructor sets custom element name
space to the namespace in custom element definition"> |
| 7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#instantiating-custo
m-elements"> |
| 8 <script src="../../../../resources/testharness.js"></script> |
| 9 <script src="../../../../resources/testharnessreport.js"></script> |
| 10 <script src="../testcommon.js"></script> |
| 11 <link rel="stylesheet" href="../../../../resources/testharness.css"> |
| 12 </head> |
| 13 <body> |
| 14 <div id="log"></div> |
| 15 <script> |
| 16 test(function() { |
| 17 var doc = newHTMLDocument(); |
| 18 var GeneratedConstructor = doc.registerElement('x-a'); |
| 19 var customElement = new GeneratedConstructor(); |
| 20 assert_equals(customElement.namespaceURI, HTML_NAMESPACE, |
| 21 'Custom element namespace should be equal to namespace in custom element
definition'); |
| 22 }, 'Custom element constructor sets namespace to the namespace from custom eleme
nt definition'); |
| 23 |
| 24 |
| 25 test(function() { |
| 26 var doc = newHTMLDocument(); |
| 27 HTML5_ELEMENTS.forEach(function(tagName) { |
| 28 var obj = doc.createElement(tagName); |
| 29 var name = 'x-b-' + tagName; |
| 30 var proto = Object.create(obj.constructor.prototype); |
| 31 var GeneratedConstructor = doc.registerElement(name, { |
| 32 prototype: proto, |
| 33 extends: tagName |
| 34 }); |
| 35 var customElement = new GeneratedConstructor(); |
| 36 |
| 37 assert_equals(customElement.namespaceURI, HTML_NAMESPACE, |
| 38 'Custom element namespace should be equal to namespace in custom ele
ment definition'); |
| 39 }); |
| 40 }, 'Custom element constructor sets namespace to the namespace from custom eleme
nt definition. ' + |
| 41 'Test constructor of extended HTML element'); |
| 42 </script> |
| 43 </body> |
| 44 </html> |
OLD | NEW |