| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Register and create custom element</title> |
| <link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru"> |
| <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| </head> |
| <body> |
| <div id="log"></div> |
| <script> |
| var proto = Object.create(HTMLElement.prototype); |
| proto.createdCallback = function() { |
| document.querySelector('#log').textContent = 'Created callback was called'; |
| }; |
| document.registerElement('x-element', {prototype: proto}); |
| </script> |
| <x-element id="x-element"></x-element> |
| </body> |
| </html> |