Re: Simulating clicks on the DOM node of the GMAIL page.
Neil Deakin <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Amit Saurav wrote: > Thanks for the pointers... :) > > Here are the details: > > Consider the situation: > <span> > <a> > To click > </a> > </span> > > Whenever I call the dispatchEvent on the <a> tag, my click is > simulated as expected. But when i call the dispatchEvent on the <span> > tag, the link is not followed. If you are trying to just open the link's url, you should just set document.location = link.href Does the dispatchEvent depend upon the > type of DOM node? That is, can the click event be simulated only on > elemnts which are actually clickable by default (like <a> etc)? Cant > it be simulated on "any" element in the DOM? dispatchEvent will work on any element and will dispatch a DOM event to the element you targeted. It won't activate the link though since you didn't target it.