eternicode/bootstrap-datepicker — pull request #622 by stipsan (2013-08-29 19:42:42+00:00)
Title: Bug: Using .trigger instead of .triggerHandler causes unpredictable behavior

The datepicker is currently firing events using .trigger.
This creates unvanted sideeffects since jQuery will attempt to fire methods attached to the element.

For instance, when loading MooTools More on the page the HTMLElement prototype gets a .hide method.
This causes instances of the datepicker used in the 'component' view mode to dissappear on blur, as demonstrated here: http://jsfiddle.net/CrZrX/3/

By using triggerHandler instead of trigger, only event handlers will be fired and unpredictable behaviors like the jsfiddle example no longer happen.

I attached a unit test that makes sure that dom methods isn't fired when the method name is the same as the event name being triggered.

The bugfix can be tested in this fiddle: http://jsfiddle.net/CrZrX/6/