I recently upgraded from 1.x to 2.x and am having an issue with the toolbar not opening in Safari or Chrome. I can see the toolbar wedge but when clicked on, it does not open. I receive the following JS error:
Uncaught TypeError: Object function (D,E){var C=E||window;for(var B=0,A=this.length;B<A;++B){D.call(C,this[B],B,this)}} has no method 'split'
/sites/all/modules/admin/includes/admin.toolbar.js?i:144
The toolbar works fine in Firefox.
I tried deleting the module, re-uploading the module, running update.php and clearing cache all with no luck.
A side note: I find the UI of 1.x to be more intuitive for non-tech savvy content authors. But I needed to upgrade to 2.x because 1.x was incompatible with Ubercart.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 797492_fix_attr_undefined.patch | 568 bytes | altrugon |
| #7 | admin.toolbar.js_.patch | 605 bytes | andermt |
| #6 | admin_fix_split_issue_with_twitter_widget.patch | 706 bytes | bibo |
Comments
Comment #1
bibo commentedI'm having the same problem (using Chrome on Mac OS, same on Linux). Same JS error.
Having tested this a bit, it seems the issue is somehow related to views ajax. The toolbar actually works on pages other than the frontpage (which are not views). The difference in loaded js files is these two:
So I'm guessing the problem is related to views. I'm using these module versions:
admin 6.x-2.0-beta3
views 6.x-2.10
ctools 6.x-dev (2010-May-27), also tested 6.x-1.4
Comment #2
bibo commentedSome testing:
- Disabling Ajax on views had no effect for better or worse (so it's not caused by /views/js/ajax_view.js file )
- Disabling/enabling JS aggregation has no effect
- Disabling panels (or panels_node, to be more specific) => FIXED
--> It hides all the panels on the frontpage, which is a lot of content, so hard to say. But it might have something to do with invidual id:s.
More info:
On the frontpage there is a panel with several views/blocks. Some nodes are connected via node_relationship (dunno if that matters). The theme is a customized subtheme of zen. Admin theme is a custom subtheme of rubik (basically just rubik). Only the frontpage seems to bug, and only with Chrome :S
In other words, I still haven't found what exactly causes this. It's not critical at the moment, since our clients don't generally use Chrome.. but I do.
EDIT: I just found out the problem is related to the active theme (customized zen subtheme)! Or to be more specific, theming panels/views. When I switched to some of the basic drupal themes, all worked just fine. So this is not really a bug with the module, but a feature request to support some module/theming combination. (I'm still not sure which exactly though).
Comment #3
yhahn commentedThank you for taking the time to debug this. Keep me posted if you learn any more.
Comment #4
bibo commentedI had finally some time to debug this more. I think I found the culprit: widget.js, which belongs to a custom made twitter window (which was in one of the CCK templates added by a fellow developer).
This is a snippet of the template:
Commenting or removing this line clears the JS error:
....and all is fine. Except the Twitter window, which naturally don't work anymore :(
@rootdownmedia: are you also using a twitter block or something like that?
@yhahn: any chance you could take a look at the twitter code :)?
Comment #5
bibo commentedMore testing: it's not just chrome failing, but Safari and IE aswell (Firefox and Opera seem unaffected).
Luckily I finally found another Drupal issue about the same widget.js incompatibility, for views: #798764: base.js line 67 chrome, variable pairs[i] sometimes contain functions and not only stings.
Their recent solution was some changes to base.js, to fix the same "split" error like this:
@yhahn, could this code be adapted for admin.toolbar.js?
Comment #6
bibo commentedOk, I figured it out. Not that much to change in the end:
I changed:
to:
JavaScript works fine again. Hooray.
I added this small change (+comments) as a patch. Hoping it gets committed soon. Or reviewed and committed, luckily there's not that much to review :)
Comment #7
andermt commentedThe patch fixed the issue only partially. In some cases in IE8 it gives errors like:
Message: 'length' is null or not an object
Line: 150
Char: 9
Code: 0
URI: http://www.mysite.com/sites/mysite.com/modules/admin/includes/admin.tool...
I've slightly changed the patch.
Comment #8
bibo commented@AnderMT thanks for noticing that. values of course cant stay undefined, and the last line needed to be moved to the additional if.
With this patch JavaScript works fine in Chrome also. Marking this "as reviewed as tested", and hoping for some attention from yhahn :)
Comment #9
Johnny vd Laar commented+1 subscribe
Comment #10
rootdownmedia commentedYes it ended up being a Twitter widget (default one from twitter.com) screwing up the toolbar. JS conflict.
Comment #11
sampeckham commentedI've been looking at this from an IE 8 perspective, (never had any problems with Safari). When i first read this post I thought it was an unrelated issue, but it seems we have both come to the same line of code causing the problem.
I've tried all three patches (the two here and one on the other thread) and still get very mixed results with IE. I don't have the twitter widget but do have other JS, one that seems to break with this module is jqgalscroll.js for sliding panes (it works fine usually), but also have problems on clean installs with views and cck the only additions.
Had problems getting AnderMT's patch to take though. Can someone post the final function so I can get a clear idea of what it should look like?
Been trying admin beta4 as well with the same results.
Comment #12
andermt commentedFor beta4 it will be like this:
Comment #13
shark commentedI also had this issue and am using the Twitter widget. The patch from #7 worked for me. Using Chrome 5.0.375.99 beta on Linux.
Comment #14
yhahn commentedThank you, and I apologize for the delay: http://drupal.org/cvs?commit=400594
Comment #15
TheInspector commentedI have the same issue when I'm using Chrome and the Twitter widget. The console says:
jquery.drilldown.js:89 Uncaught TypeError: Cannot call method 'attr' of undefined
Comment #17
askibinski commented@TheInspector:
I had that issue too with twitter/jquery widgets (for example jquery_slideshow)
Adding an extra check in jquery.drilldown.js to see if it's an object fixed it for me:
Comment #18
harking commentedTested #17's patch and it corrected the issue of #15
Comment #19
HylkeVDS commentedI just ran into the same problem, and some searching resulted in this:
https://developer.mozilla.org/en/JavaScript/Reference/Statements/For...in
So better is to change jquery.drilldown.js line 83 to
Comment #20
tancAlso had this problem but this time a clash with a 3rd party library. #19 fixed my issue.
Comment #21
altrugon commentedBoth #17 and #19 solve the issue jquery.drilldown.js:89 Uncaught TypeError: Cannot call method 'attr' of undefined, but since breadcrumb is actually an array I would say the solution in #19 is more appropriated.
Here is a patch that worked for me using the solution in #19.
Comment #22
agileware commentedThe issue from the original post was fixed in #14, the error you are now reporting is a different issue.
Putting settings back to what they were.
There is already another issue for what you are now reporting anyway, which is here - #969916: jquery.drilldown.js Breadcrumb error
Comment #23
bnewtonius commented#17 is right, but overall you shouldn't be using a for in loop here. Webkit browsers behave differently, and they will return all methods of that object as well as the indexes for an array, where FireFox will not.
Should be changed to something like:
This will keep it from trying to run the code with a key of something like "filter" or "push", which are methods on that object, not indexes in the array.
Ogg says "for in loops bad. Ogg smash for in loops"
Comment #24
bnewtonius commentedOgg, er, I mean, I just saw the comment #22, seems like someone smarter (and possibly better looking) has already solved this.