Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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/
Comment | File | Size | Author |
---|---|---|---|
#8 | 2114599-panels-jquery-browser-deprecated.patch | 438 bytes | jmking |
#1 | panels.code_.2114599-1.patch | 755 bytes | ericduran |
Comments
Comment #1
ericduran CreditAttribution: ericduran commentedSimple check.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedI had found a different solution:
if (navigator.userAgent.match(/msie [6]/i)) {
Maybe both work. Thanks for the patch anyway.
Comment #3
becw CreditAttribution: becw commentedI'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?
Comment #4
malcomio CreditAttribution: malcomio commentedThere'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
Comment #5
ericduran CreditAttribution: ericduran commentedThe original patch should still be the correct approach. I think ;-)
Comment #6
pacproduct CreditAttribution: pacproduct commentedIsn'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)) {
?
Comment #7
pacproduct CreditAttribution: pacproduct commentedAs 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')
Comment #8
jmking CreditAttribution: jmking commentedI've included a patch with @pacproduct's suggestion.
Comment #10
DamienMcKennaThis was fixed in the current -dev codebase, though I don't know at what point the fix was applied.
Comment #11
DamienMcKennaFYI 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.