Skip to content

Fastfix: Original can be undefined#45

Closed
jbrumwell wants to merge 1 commit intobitovi:masterfrom
jbrumwell:eventpagexy
Closed

Fastfix: Original can be undefined#45
jbrumwell wants to merge 1 commit intobitovi:masterfrom
jbrumwell:eventpagexy

Conversation

@jbrumwell
Copy link

Fixes pageX, pageY and which for when the original event does not exist and
the original value is undefined.

I was working with a jquery plugin that invokes mousemove like so

/trigger mousemove to move the knob to the current position
            $(document).on({
                mousemove: $.proxy(this.mousemove, this),
                mouseup: $.proxy(this.mouseup, this)
}).trigger('mousemove');

Since the mousemove handler handles actually mouse movements and this custom event, when calling:

var something = e.pageX || someothervalue;

It causes and error "original is undefined" I have not needed the which event but it most likely suffers from the same issue.

Fixes pageX, pageY and which for when the original event does not exist and
the original value is undefined
@daffl
Copy link
Contributor

daffl commented Aug 24, 2012

Good point. It seems as if every special mapping should have a

if(!original) {
    return;
}

As relatedTarget already does.

@daffl daffl closed this in 34f1c67 Aug 28, 2012
@daffl
Copy link
Contributor

daffl commented Aug 28, 2012

I fixed it with the snippet I mentioned. Let me know if there are any problems with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants