#540 ✓invalid

Issue createEvent('MouseEvents') - initMouseEvent - dispatchEvent

Reported by Scriptish | September 18th, 2011 @ 09:54 PM | in Bug Crushing

As you suggested/asked I'll try to be a bit more specific on the problems PS MWAP (PlayerScripts Mafia Wars AutoPlayer) is having when ran in FF6 and up using Scriptish.

The script seems to be loading, initialising and running fine (elements are enhanced, added to the page, css changed, ...) until we try to simulate a 'mouse click'.

When we try to execute the following code / function :

function clickElement(elt) {
if (!elt) {

colorDEBUG('BUG DETECTED: Null element passed to clickElement().', cre);


// Simulate a mouse click on the element. var evt = document.createEvent('MouseEvents'); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); elt.dispatchEvent(evt); }

It just makes the page reload ...

This happens for both links / buttons already on the page and on links / buttons that the script is adding to the page.
If I manually click any of the existing or added links or buttons, it is working/behaving as it should ...

We have been using this function for years in FF 2 and FF3 using Greasekmonkey without problems ...

I hope you can nail down and solve this problem with the info I provided ...

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket