Out of curiosity -- what is the purpose of / use cases for jQuery's triggerHandler? As far as I can tell, the only "real" differences between trigger and triggerHandler is whether or not the native event fires, and event bubbling behavior (though triggerHandler's bubbling behavior doesn't seem hard to replicate with trigger in a few more lines of code). What is the advantage to ensuring the native event does not fire?
I'm curious if this is a convenience function or there's a deeper reason it exists, and what why/when I would use it.
From the Docs at http://api.jquery.com/triggerHandler/
Not preventing the default browser actions allow you to specify an action that occurs on focus or select, etc etc etc, that applies a style. Maybe you have a dynamic menu that is Javascript based, so you don't want to apply the style purely with CSS otherwise those with Javascript disabled won't understand why the layout looks odd. You can use something like
$('menu1select').triggerHandler('click');If you have an event which hides an element onclick for example, and you want to call that function generally, instead of having to specify each element, you can use
$('.menu').triggerHandler('click');Prevents propagation, hopyfully don't have to explain this one...
This one should be self explanatory as well...