When using Panels with a site running jQuery 1.9 or above (using the 2.x-dev release of the jquery_update module), panels.js throws the following javascript error on every page:

TypeError: $.browser is undefined

This jQuery feature was deprecated in version 1.3, and removed in 1.9: http://api.jquery.com/jQuery.browser/

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ericduran’s picture

Status: Active » Needs review
FileSize
755 bytes

Simple check.

Anonymous’s picture

I had found a different solution:
if (navigator.userAgent.match(/msie [6]/i)) {
Maybe both work. Thanks for the patch anyway.

becw’s picture

Issue summary: View changes

I've updated the issue description to describe why this is a problem. The patch from #1 suppresses this error and doesn't break the existing functionality.

It seems like the only thing in panels.js right now is an IE workaround (it attaches a hover event in IE in order to make the admin links accessible), but I'm not sure which IE versions require this--perhaps it's IE 6 and can be deprecated entirely? Maybe there's a direct substitution that uses feature detection instead?

malcomio’s picture

There's a similar patch to admin_menu #1961178: jQuery.browser removed, $.browser.msie is undefined which implies that it's for older IE versions.

Currently testing this patch on IE8 and above

ericduran’s picture

The original patch should still be the correct approach. I think ;-)

pacproduct’s picture

Isn't patch #1 actually just ignoring what is inside the if, making that JavaScript file ineffective on sites using JQuery 1.9+?
Feels to me like morningtime's approch is more sensible, is it not?

So, if we want to test if current browser is IE, why not just using the following code for the test:
if (navigator.userAgent.match(/msie/i)) {
?

pacproduct’s picture

As per msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx a reliable way of testing if the current browser is IE would be:
if (navigator.appName == 'Microsoft Internet Explorer')

jmking’s picture

I've included a patch with @pacproduct's suggestion.

Status: Needs review » Needs work

The last submitted patch, 8: 2114599-panels-jquery-browser-deprecated.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Fixed

This was fixed in the current -dev codebase, though I don't know at what point the fix was applied.

DamienMcKenna’s picture

FYI the current -dev release doesn't have js/panels.js anymore, so there evidently was a bunch of refactoring at some point that no longer depends upon the $.browser object.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.