There is an issue with Rubik theme and Admin module on some pages.

The error is the following: "$("").attr("href", $(breadcrumb[key]).attr("href")) is undefined"

Basically, we have to enforce the check on href attribute breadcrumb element.

Please, find above the patch to resolve the issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HylkeVDS’s picture

I just ran into the same problem.
jquery.drilldown.js does:
for (var key in breadcrumb) {

Some searching resulted in this:
https://developer.mozilla.org/en/JavaScript/Reference/Statements/For...in

Although it may be tempting to use this as a way to iterate over an Array, this is a bad idea. The for...in statement iterates over user-defined properties in addition to the array elements, so if you modify the array's non-integer or non-positive properties (e.g. by adding a "foo" property to it or even by adding a method or property to Array.prototype), the for...in statement will return the name of your user-defined properties in addition to the numeric indexes.

Some toolkits add properties to the array-object. These properties are also iterated over when using for...in.
So better is to change jquery.drilldown.js line 83 to

var numberOfCrumbs=breadcrumb.length;
for (var key=0; key<numberOfCrumbs;key++) {
wizonesolutions’s picture

Status: Active » Reviewed & tested by the community
Issue tags: +internet explorer

I had to apply this patch on a site I work on to resolve an error in IE, and it worked. I'm setting to RTBC since I don't think this one is going to get much visibility but I think it should be committed to -dev so it makes it into the next official release (or at least an equivalent fix).

Agileware’s picture

Priority: Normal » Major
FileSize
652 bytes

As HylkeVDS mentioned in #1 the for ... in statement also returns non-elements of the array for some browsers.

Generally for iteration:
For objects:
for (var key in o)
For arrays:
for (var i = 0; i < a.length; i++)

Since we are using an array anyway and not an object the solution mentioned in #1 would be better.

If we must use for ... in another solution would be

-            if (breadcrumb[key]) {
+           // Chrome and safari seem to like to return keys that are functions.
+           if (breadcrumb[key] && typeof breadcrumb[key] != 'function') {

This patch is for the solution in #1, which I vote for as being the optimum solution.
Patch applies cleanly to 2.0 and 2.x-dev.

For the record the error message I was getting was:

Uncaught TypeError: Cannot call method 'attr' of undefined

Agileware’s picture

Issue tags: +safari, +Google Chrome

Tagging

el_reverend’s picture

Subscribing.

Nick Robillard’s picture

Patch works for me. It'd be nice to get this in a release.

(subscribing)

charlie-s’s picture

Patch works for me as well, thanks.

mail@victorquinn.com’s picture

This patch helps resolve some errors, but it is still very much broken in jQuery 1.6. This drilldown plugin seem to be a hackish mess which hasn't been updated - should the admin module look to adopting something less buggy?

Seems like a waste of resources to have to update this jquery.drilldown.js piece manually with bug fixes every time a new version of jQuery is released.

charlie-s’s picture

Victorquinn -- how are you implementing jQuery 1.6 within Drupal 6? Drupal 6 ships with 1.2.

mail@victorquinn.com’s picture

Manually upgraded it, applied patches.

I write custom modules for a college which often makes use of jQuery plugins that require a higher version than 1.2 so I've been forced to upgrade (e.g. jQuery mobile that requires 1.4.3, jsTree which requires 1.4.2, Isotope which requires 1.4.3, etc.). For the most part, nothing else breaks, but the Admin module breaks and breaks hard, which kills javascript on the entire page.

charlie-s’s picture

In my experience a lot of Views ajax calls and things like draggable.js break with jQuery > 1.3. Also, contributed module must be allowed to depend on jQuery 1.2. I've written up a short post on using newer versions of jQuery with Drupal without altering core: http://drupal.org/node/1058168

This (recommended) method allows you to write your custom code to w/e version you want, while simultaneously allowing Drupal, Views, Admin, other contribs to all use jQuery 1.2 without them even noticing each other.

(Just in case any of this information is helpful.)

brunorios1’s picture

+1
Patch in #3 worked for me.

dan_lennox’s picture

Patch in #3 worked for me.

smira’s picture

thank you!
confirming patch #3 worked for me as well.

EgbertB’s picture

Same issue on a drupal 6.22 site
Suddenly (after a recent upgrade of some modules) got non numerical key values, namely 'filter', and the corresponding breadcrumb object was a function.
I first filtered out non numerical key's, but #3 is a better way to do this
Thanx

muhleder’s picture

Seeing this problem on 7.x-dev version as well, patch from #3 works here as well.

mikl’s picture

Title: Jquery.drilldown.js Breadcrumb error » jquery.drilldown.js Breadcrumb error
FileSize
941 bytes

Here's a Git-formatted version of the patch from #3 that should work with Drush make.

mdupont’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
707 bytes

Rerolled patch #17 and included fix from #1264958: Missing hasOwnProperty in jQuery Drilldown. Fixes the issue on my website.

praestigiare’s picture

FileSize
823 bytes

This script is a bit of a mess. The above patches can solve the array iteration problem, but there are still issues with the cloning of objects. This patch addresses them.

praestigiare’s picture

FileSize
819 bytes

Fixed to work with drush make.

praestigiare’s picture

FileSize
819 bytes

Sorry, fixed paths.

c4rl’s picture

Status: Needs review » Needs work
+++ b/includes/jquery.drilldown.jsundefined
@@ -80,14 +80,11 @@
               // We don't use the $().clone() method here because of an
               // IE & jQuery 1.2 bug.
-              var clone = $('<a></a>')
-                .attr('href', $(breadcrumb[key]).attr('href'))
-                .attr('class', $(breadcrumb[key]).attr('class'))
-                .html($(breadcrumb[key]).html())
+              var clone = $(breadcrumb[key]).clone()

Comment says we can't use clone.

c4rl’s picture

Status: Needs work » Needs review
FileSize
1.29 KB

Does this fix it for folks? Sometimes chaining .attr() methods in jQuery for empty attrs doesn't return $(this).

francis55’s picture

#23 Works for me in IE7, C4rl, thx!

ss81’s picture

Status: Needs review » Reviewed & tested by the community

#23 works for me too. Thanks!

c4rl’s picture

Issue summary: View changes

Bumparoo

aCCa’s picture

I had Webform Fieldsets not linkable and not showing inside contents. This was related to conflicts with Admin module and especially with jquery.drilldown.js.

#23 solved also my issue.