Re: [w3c/webcomponents] Element Behaviors, and the has="" attribute. A useful alternative to Custom Elements in many cases! (#727)

> Please use inclusive language: https://notapattern.net/2014/10/14/ways-men-in-tech-are-unintentionally-sexist/.

Sorry. Based on @Nashorn's GitHub profile, I can not tell whether Nashorn is a guy or gal. I should've used "guys" only if I'd known you both were under the "he/him" pronouns.

> As for determining interest, I wrote that comment during a face-to-face meeting, minutes available at #713 (comment).

Can you quickly summarize that part?

---

Now that you have examples of how I'm using `element-behaviors` in the above non-imaginary examples, what do you think about it?

Maybe there is not any interest because it simply doesn't exist and people aren't aware of it?

As far as I know, [A-Frame](http://aframe.io) is the only big library out there that has anything similar to this, they call it "entity-components" instead of "element-behaviors", but they are the same things. Theirs is only slightly different from mine: theirs is more like custom-attributes, and their custom attribute values accept `style`-like key-value pairs as input into the components (it maps to a POJO inside the component).

As far as I can tell, people who use A-Frame love it.

In my case, element-behaviors is not tied to a specific library (f.e. A-Frame's entity-components are specific to A-Frame, not usable on any elements), and mine can be used on any elements.

In practice, I'm using it in the real-world (not yet production, but aiming to be so soon) here: https://github.com/trusktr/infamous/tree/master/examples.

---

> (SIDENOTE I want to rename "element-behaviors" to "element-traits" or "element-features" or "element-characteristic", because "behaviors" implies that each feature is associated with an action or verb: a behavior is a manner in which something acts by means of verbs. In contrast a feature or trait or characteristic can be merely the existence adjectives or nouns (f.e. a data object from which to read from and that doesn't execute any logic).
> 
> In this sense, a "phong-material" doesn't do anything in my lib, it's only there for meshes, models, geometries, and other renderables (other features) to do something with.

---

I'm really liking this entity-component/element-feature system that I have going on, and can see my self using it in place of custom elements in many cases.

What I notice, in many Custom Element uses, is that people usually extend `HTMLElement` and give it basic styling. This is equivalent to just using a `<div>` element and then adding a behavior/feature/trait/characteristic to it.

And this perfectly solves the table/tr/td issues, for example, in a way that works in old browsers without requiring any of the intricacies of native `class`es. It's a win-win.

I think would like it if the browser vendors released such a feature. Just like people didn't know they wanted iPhone until Apple released it and made people realize it was what they needed.

-- 
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/727#issuecomment-452109299

Received on Monday, 7 January 2019 22:46:22 UTC