Re: [w3c/webcomponents] accessibility considerations: states and behaviors (#567)

@domenic

>To create your own behavior, you can use the normal compositional techniques in JavaScript, i.e. functions. Do addAwesomeBehavior(this) in your constructor.

Behaviors would allow you to listen to attribute changes very easily, besides allowing you to set states and add default attributes to elements.

> To be clear, global string-indexed registries are an antipattern that we should avoid when they're not necessary. […] Normal JavaScript composition via lexically-scoped and imported functions is a much better solution.

It’s important to note that functions are “global string‐indexed registries”. The have a named (a string index) and are declared (registered) on the Javascript top‐level (global).

> They are necessary for custom HTML element names, because of the interaction with the parser and with CSS.

It’s also interesting to note that behaviors would interact with CSS as well.

-- 
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/567#issuecomment-247060631

Received on Wednesday, 14 September 2016 15:55:02 UTC