OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <meta charset=utf-8> | |
3 <title>Custom element's type is immutable.</title> | |
4 <meta name="author" title="Bon-Yong Lee" href="mailto:bylee78@gmail.com"> | |
5 <meta name="assert" content="After a custom element is instantiated, changing th
e value of the is attribute must not affect this element's custom element type."
> | |
6 <link rel="help" href="http://w3c.github.io/webcomponents/spec/custom/#instantia
ting-custom-elements"> | |
7 <script src="../../../../resources/testharness.js"></script> | |
8 <script src="../../../../resources/testharnessreport.js"></script> | |
9 <div id="log"></div> | |
10 <script type="text/javascript"> | |
11 test(function() { | |
12 var CustomButton = document.registerElement('custom-button', { | |
13 prototype: Object.create(HTMLButtonElement.prototype), | |
14 extends: 'button' | |
15 }); | |
16 var customButton = document.createElement('button', 'custom-button'); | |
17 | |
18 assert_true(customButton instanceof CustomButton, | |
19 'A custom element is of the custom element type after ' + | |
20 'instantiation'); | |
21 customButton.setAttribute('is', 'dirty'); | |
22 assert_equals('dirty', customButton.getAttribute('is'), | |
23 'An attribute must be changed by method "setAttribute"'); | |
24 | |
25 assert_true(customButton instanceof CustomButton, | |
26 'A custom element is of the original custom element type even ' + | |
27 'after changing the \'is\' attribute'); | |
28 }, 'After a custom element is instantiated, changing the value of the is attribu
te must not affect this element\'s custom element type.'); | |
29 </script> | |
OLD | NEW |