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