Let's say I have an element on a web page created via a dojo widget that has events attached using dojoAttachEvent that looks like so:
<span id="menuItemIWantToTrigger" dojoattachevent="onMouseOver: onHover; onMouseOut: onUnhover; onClick: _onClick;" class="dojoMenuItem2" style="-moz-user-select: none;" dojoinsertionindex="4">Workflow... </span>
I need a click on another element on the page to trigger the onClick event on the widget element. In Firefox 5, I can remotely trigger the event using the plain old JavaScript .click()
method, like so:
document.getElementById('menuItemIWantToTrigger').click();
In other browsers (like Firefox 3.6 and 4), that method doesn't work. It seems that those browsers don't pass the triggered click event onto the widget's dojoAttachEvent handlers, but Firefox 5 (and, weirdly, IE 7) do; in fact, those browsers seem to handle dojoAttachEvents exactly like plain old DOM events. So, is there any way I can trigger the onClick dojoAttachEvent in all browsers the same way I can trigger it in Firefox 5?
An important note: I don't have access to the code that's creating the dojo widget elements, so I can't rewrite the way events are bound.