- From: Marchenko Alexandr <notifications@github.com>
- Date: Sun, 01 Jul 2018 20:50:03 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 2 July 2018 03:50:27 UTC
One more about confusion: how should we create such components dynamically?
e.g. I have a component
```js
class FancyInput extends HTMLInputElement {
constructor() {
super();
this.addEventListener('click', e => {
console.log('clicked');
});
}
}
customElements.define('fancy-input', FancyInput, { extends: 'input' });
```
So, from now on, anywhere on a page I can do something like `<input is="fancy-input" >` and each click on it will be logged to console.
But how about dynamically created items?
```js
// var inp = document.createElement('fancy-input'); // not working - does not render anything
var inp = document.createElement('input');
// inp.is = 'fancy-input'; // not working
// inp.setAttribute('is', 'fancy-input'); // not working
document.body.appendChild(inp);
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/509#issuecomment-401664944
Received on Monday, 2 July 2018 03:50:27 UTC