Added checks to triggerEvent for optional data and element verification. Uses $.apply...