Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastfix: Original can be undefined #45

Closed
wants to merge 1 commit into from

Conversation

@jbrumwell
Copy link

@jbrumwell jbrumwell commented Aug 17, 2012

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 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 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.