googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 61 forks source link

custom attributes #100

Closed aeosynth closed 11 years ago

aeosynth commented 11 years ago

this may be out of scope, but i'd like custom attributes, so i can implement my own version of declarative event mapping

rafaelw commented 11 years ago

i'm not sure what that means. can you provide an example of what you'd like to work?

aeosynth commented 11 years ago

a custom on-click attribute: ```

pulled from a polymer example

rafaelw commented 11 years ago

you're not being clear. what do you want to work which doesn't work right now.

You can put whatever attribute you want on elements. The parser will not stop you.

aeosynth commented 11 years ago

i would like to define a custom attribute, and when the parser sees this attribute, my custom code is run, similar to what the parser does with {{ }} syntax

rafaelw commented 11 years ago

Yeah, unfortunately this is outside the scope of MDV. It sounds like you'd like to mix in behavior to an element based on the presence of an attribute. I suggest using mutation observers and the mutation summary library for this. There's no good way to observe an attribute pattern (e.g. "on-*"), but if you enumerate the attributes you support, it will work.

See MutationSummary: https://code.google.com/p/mutation-summary/

Closing this issue

FunkMonkey commented 10 years ago

Isn't this similar to decorators (and another source)?

Only thing that could get in the way:

The script is run once when the decorator element is inserted into the document