Skip to content

Conversation

@mrMarco
Copy link
Contributor

@mrMarco mrMarco commented Dec 25, 2015

When a selector has been assigned to the appendTo option, the context menu wasn't (always?) positioned at the cursor position.
This fix solves the problem.

When a selector has been assigned to the appendTo option, the context menu wasn't (always?) positioned at the cursor position.
This fix solves the problem.
@bbrala
Copy link
Member

bbrala commented Dec 26, 2015

Thank you for the contribution. In the tests it breaks on what seems a lack of srcElement. I think srcElement is not the cross browser property for that. Shouldn't this just be .target?

My last solution wasn't browser-independant. now it is.
@mrMarco
Copy link
Contributor Author

mrMarco commented Dec 26, 2015

@bbrala: You're right. that isn't browser-independant. I've changed the new lines slightly to solve that. The new lines are now like this:

var menuContainer = (e.data.appendTo === null ? $('body') : $(e.data.appendTo));
var srcElement = e.target || e.srcElement || e.originalTarget;
op.show.call($this, e.data,
$(srcElement).offset().left - menuContainer.offset().left + e.offsetX,
$(srcElement).offset().top - menuContainer.offset().top + e.offsetY);

I've also commited the file again with the above lines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be .target since jQuery normalizes the event.

@bbrala bbrala merged commit ee0a1d1 into swisnl:master Jan 8, 2016
@bbrala
Copy link
Member

bbrala commented Jan 8, 2016

Thanks for the contribution, it has been merged.

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