OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Document.createElement() and Document.createElementNS() set IS attribute
to type</title> |
| 5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| 6 <meta name="assert" content="If TYPE is not the same as localName, set the value
of ELEMENT's IS attribute to TYPE"> |
| 7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-docum
ent-interface-to-instantiate"> |
| 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 HTML5_ELEMENTS.forEach(function(tagName) { |
| 19 var obj = doc.createElement(tagName); |
| 20 var name = 'x-a-' + tagName; |
| 21 var proto = Object.create(obj.constructor.prototype); |
| 22 doc.registerElement(name, {prototype: proto, extends: tagName}); |
| 23 var customElement = doc.createElement(tagName, name); |
| 24 assert_equals(customElement.getAttribute('is'), name, |
| 25 'Value of the IS attribute should be set to type by Document.createE
lement()'); |
| 26 }); |
| 27 }, 'Test Document.createElement() sets the element\'s IS attribute value to type
, ' + |
| 28 'if type is not the same as localName'); |
| 29 |
| 30 |
| 31 test(function() { |
| 32 var doc = newHTMLDocument(); |
| 33 HTML5_ELEMENTS.forEach(function(tagName) { |
| 34 var name = 'x-b-' + tagName; |
| 35 var customElement = doc.createElement(tagName, name); |
| 36 assert_equals(customElement.getAttribute('is'), name, |
| 37 'Value of the IS attribute should be set to type by Document.createE
lement()'); |
| 38 }); |
| 39 }, 'Test Document.createElement() sets the element\'s IS attribute value to type
, ' + |
| 40 'if type is not the same as localName and an element definition with matchin
g ' + |
| 41 'localName, namespace, and type is not registered'); |
| 42 |
| 43 |
| 44 test(function() { |
| 45 var doc = newHTMLDocument(); |
| 46 HTML5_ELEMENTS.forEach(function(tagName) { |
| 47 var obj = doc.createElement(tagName); |
| 48 var name = 'x-c-' + tagName; |
| 49 var proto = Object.create(obj.constructor.prototype); |
| 50 doc.registerElement(name, {prototype: proto, extends: tagName}); |
| 51 var customElement = doc.createElementNS(HTML_NAMESPACE, tagName, name); |
| 52 assert_equals(customElement.getAttribute('is'), name, |
| 53 'Value of the IS attribute should be set to type by Document.createE
lementNS()'); |
| 54 }); |
| 55 }, 'Test Document.createElementNS() sets the element\'s IS attribute value to ty
pe, ' + |
| 56 'if type is not the same as localName'); |
| 57 |
| 58 |
| 59 test(function() { |
| 60 var doc = newHTMLDocument(); |
| 61 HTML5_ELEMENTS.forEach(function(tagName) { |
| 62 var name = 'x-d-' + tagName; |
| 63 var customElement = doc.createElementNS(HTML_NAMESPACE, tagName, name); |
| 64 assert_equals(customElement.getAttribute('is'), name, |
| 65 'Value of the IS attribute should be set to type by Document.createE
lementNS()'); |
| 66 }); |
| 67 }, 'Test Document.createElementNS() sets the element\'s IS attribute value to ty
pe, ' + |
| 68 'if type is not the same as localNameand and an element definition with matc
hing ' + |
| 69 'localName, namespace, and type is not registered '); |
| 70 </script> |
| 71 </body> |
| 72 </html> |
OLD | NEW |