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.
After spending too much time on this I realized that #1127530: Use of a reserved word and this issue are for 6.x-3.x-dev and issue #1221668: Breaks a lot of functionality when Aggregate JavaScript is on is for 7.x-3.x
This issue came from #1127530: Use of a reserved word, which turned out to be two parts.
Apparently, even after that patch, AMH still does not work with Safari.
Comment | File | Size | Author |
---|---|---|---|
#2 | admin_menu_dropdown_1128944_2.patch | 1.68 KB | Josh The Geek |
Comments
Comment #1
Josh The Geek CreditAttribution: Josh The Geek commentedThe problem is the defer attribute: I use the defer attribute of the script tag to delay the running of amh's scripts until the config variable is set up. According to http://www.w3schools.com/tags/att_script_defer.asp , IE is the only browser that supports this tag. (Apparently, it works in Firefox and Chrome, too.)
Safari does not know what the attribute means, so it gets skipped. The scripts are run before the config variable is loaded, causing a 'TypeError: Result of expression 'Drupal.settings.admin_menu_dropdown' [undefined] is not an object.'
The solution is to wrap the code in
jQuery(document).ready(function(){})
. Patch coming shortly.Screenshot of Safari debugger: https://skitch.com/joshthegeek/r4q94/defer-attribute-used-by-admin-menu-...
Comment #2
Josh The Geek CreditAttribution: Josh The Geek commentedPatch.
Comment #3
ejohnson CreditAttribution: ejohnson commentedPatch seems to fix it now in Safari.
Testing in Firefox 3 and IE8 as well.
Thanks.
Comment #4
distinctgrey CreditAttribution: distinctgrey commentedAfter having applied the patches from both issues, Firebug still showed errors.
What you want is to execute the JS only after the config variable has been set up.
To do this correctly in Drupal, do not use document.ready(), but wrap the JS code as follows:
This works for me, without any more errors showing up in Firebug.
Comment #5
izmeez CreditAttribution: izmeez commentedAs a followup to @distinctgrey attached is the suggestion in comment #4 as a patch for review.Ignore this patch, it is confusing 7.x-3.x with 6.x-3.x which is what this issue is about.
Comment #6
izmeez CreditAttribution: izmeez commentedThe patch I uploaded in #5 is actually for admin_menu_dropdown 7.x-3.x so I am changing the version.I hope the suggestion in comment #4 was for 7.x-3.x but I have not tested with safari, not my usual environment.
1 will have to do some tests to see if this is even needed.
Removing comments as not relevant.
Comment #7
izmeez CreditAttribution: izmeez commentedAs mentioned in the opening of the issue summary the problem has been twofold, the module code and the javascript.The patch in #2 again combines changes to the module code and the javascript and should be abandoned in favor ofIssue #1221668: Breaks a lot of functionality when Aggregate JavaScript is onwith this issue focusing on the javascript.Attached is an update to patch in #5 incorporating suggestions in #4 for review and testing.Removed comments as not relevant.
Comment #8
izmeez CreditAttribution: izmeez commentedAfter spending too much time on this I realized that #1127530: Use of a reserved word and this issue are for 6.x-3.x-dev and issue #1221668: Breaks a lot of functionality when Aggregate JavaScript is on is for 7.x-3.x
Comment #9
izmeez CreditAttribution: izmeez commented