guillaumepotier/Parsley.js — pull request #804 by marcandre (2014-12-20 23:41:01+00:00)
Title: Jquery events

Summary: Replace homegrown pubsub by jQuery events

Details:
I do not know the original thought behind the pubsub mechanism of Parsley.

I feel it is problematic though. In particular:
* pollutes jQuery with highly generic names (emit, listen, listenTo, .....). High risk of collision.
* must manually unsubscribe to avoid leaks
* cognitive overload, as it's a new api, while there's already jQuery events and jQuery callbacks

On the other hand, using jQuery events instead has many advantages:
* already well known to developers
* automatically takes care of unbinding when DOM elements removed using jQuery
* can be bound anywhere (for example on a div containing a bunch of inputs)
* can be manipulated easily with namespace

This PR switches to jQuery events while keeping compatibility with the previous API.

First a couple of tests are modified to rely on the effects instead of the implementation.
Then the implementation of pubsub is changed to use jQuery events. All tests still pass.
Finally all internal calls to the old API are changed, so the pub sub module can be deprecated.

I’ve named the new events by adapting them from `parsley:form:init` to `form:init.parlsey`, but maybe they should remain the same?