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

jQuery.browser removed in 1.9 #15

Open
Kipperlenny opened this issue Jan 27, 2013 · 2 comments
Open

jQuery.browser removed in 1.9 #15

Kipperlenny opened this issue Jan 27, 2013 · 2 comments

Comments

@Kipperlenny
Copy link

http://api.jquery.com/jQuery.browser/ was removed (and depr. since 1.3)

Your code now fails here:

if ($.browser.msie && options.leftClick) {
  mouseEvent = 'click';
} else if ($.browser.msie && !options.leftClick) {
  mouseEvent = 'contextmenu';
}
@emmaly
Copy link

emmaly commented Apr 11, 2013

You can get around this by using https://github.com/jquery/jquery-migrate/ for the moment. Hopefully this code will be updated to stop relying on $.browser.

@ke1g
Copy link

ke1g commented May 7, 2013

My understanding is that the need for browser here is because IE doesn't provide the same values for the button attribute of a mouse event as "standards compliant" browsers, and we want to determine which button was clicked.
Some testing with IE 8 (the only IE I have handy for testing) and a recent FireFox shows the issue to be worse, in that button, which, and buttons are all unreliable on 'click' and 'contextmenu' events, even in FireFox. They're reasonably well documented for 'mousedown', and IE8 behaves as expected here, but at that time you don't know if there will be a 'click' versus a drag, for example.
An alternative approach takes advantage of the fact (tell me if this isn't universal) that the 'click' event isn't generated for right clicks, and the 'contextmenu' event isn't generated for other, including left, clicks. So create two separate handlers, one for the "correct" button (pretty much the existing handler with the determination of correct versus incorrect button removed), and one for the "wrong" button (just calls hideMenu()). Then bind one to 'click' and one to 'contextmenu', using options.leftClick to decide which event gets which handler.
While I haven't exhaustively tested it, I have an example of the above that works for me. If requested by arnklint I can either send him a copy or go through the fork, modify, pull-request route.

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

No branches or pull requests

3 participants