- From: Joseph Orbegoso Pea <notifications@github.com>
- Date: Thu, 07 Sep 2017 04:30:30 +0000 (UTC)
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/662/327681665@github.com>
@wiredearp > It is always the frameworks job to provide an awesome API for folks building websites while it is the specifications job to provide a tedious API for folks building frameworks, which is different. I disagree. It should be very easy for people to use native web tech to easily build apps, without necessarily needing a framework. I think this is a good goal. Your example, > ```html > <table is="very-generic" also="bar lorem"><table> > ``` > ```js > const behaviors = { > bar: { connectedCallback(elm) { elm.classList.add('bar'); } } > lorem: { connectedCallback(elm) { elm.classList.add('lorem'); } } > }; > const getbehaviors(elm) => { > return elm.getAttribute('also').split(' ').map(name => behaviors[name]); > } > CustomElements.define('very-generic', class { > connectedCallback() { > getbehaviors(this).forEach(b => b.connectedCallback(this)); > } > }); > ``` is much too verbose. This isn't relying on any new native behavior, it's just mapping some "behaviors" to CE callbacks manually, which is a good conceptual of making a polyfill for the idea here. And it's easy to make such a polyfill. I guess maybe you want to show that a feature like the one I proposed in the original post can easily be implemented in JavaScript. You're right, it probably can be, and this is due to the fact that behaviors are not required to extend from native classes like HTMLElement. This fact alone makes everything just easy to work with. --- The thing is, if it were spec'd and became standard, people could rely on it, and not have to choose between a gazillion different frameworks and libraries, and it'd work in every single web application without compatibility issues (or with the least amount of compatibility issues) because it would be API guaranteed to exist in every browser. -- 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/662#issuecomment-327681665
Received on Thursday, 7 September 2017 04:30:55 UTC