bigcommerce/mozart — pull request #8 by tomcully (2013-07-15 02:02:48+00:00)
Title: Added magic event method deprecation

Mozart has an Undocumented Feature* in which methods on views with the following names are called whenever the associated event is raised on the view element:

click, dblclick, focus, blur, keyup, keydown, keypress, focusout, focusin, change, mouseover, mouseout

I propose that this behaviour be deprecated, as it is 'magical' and causes unintended operation when these method names are used in views. Instead, I propose the view would do a publish(eventName, view) on itself when these events are received.

Pros: Less magical behaviour. Able to use method names as above without unintended operation. Ties in with automatic Action definitions on views, as event is now automatically raised, e.g. {{view tag="button" clickAction="save"}}Save{{/view}}
Cons: Slightly more Boilerplate, a view wanting notification on events on its element must subscribe to them.

This PR, although complete and functional, is intended to start a discussion.

* sense 1, not actually a bug.