Hi, I understand what my problem is - W3C event objects are not global but are passed to the handler, IE they are global. I've run into this issue before but I do so little front-end stuff I can't recall how to fix it.

Here is my function, works just fine in Midori, obviously not in FireFox - and yes, I'm using jQuery but not the jQuery-UI - but this doesn't appear to be a jQuery issue.

function tiledrop(nnode) {
    "use strict";
    var x, y, tnum, swapnode, swaptile;
    tnum = $(nnode).attr('data-tile');
    x = event.clientX;
    y = event.clientY;
    swapnode = document.elementFromPoint(x, y);
    //make sure it was dropped on another tile
    if ($(swapnode).attr('data-tile')) {
        swaptile = $(swapnode).attr('data-tile');
        swaptiles(tnum, swaptile);
    } else {
Here is how it is attached to the objects -

$('#puzzle').find('img').bind('dragend',   function () {tiledrop(this); });
Basically what it does, when a puzzle piece (square) is dragged onto another, it switches places with it via/ my swapTiles function (which does work everywhere)
So I have to pass the node of the image being dragged to the function, which gets the node of the image image it was dragged to from the mouse position.

Works in Midori just dandy, but FireFox event is not global.

Do I really need to write two different functions and detect which one to attach or is there an elegant way to do it with a single function?

Any suggests are appreciated.