I have been experiencing a problem with ExtJS:
this.indexOf is not a function

I found out that this is being caused by the below code in the ExtJS library:

remove : function(o){
       var index = this.indexOf(o);
       if(index != -1){
           this.splice(index, 1);
       }
       return this;
    }

I read this http://mankzblog.wordpress.com/2009/05/23/trying-to-combine-ext-core-and... blog post and it suggests using using hasOwnProperty.

So i fiddles just a little bit and found this if statement on line 85 of jquery.drilldown.js:
if (breadcrumb[key]) {

and i changed it to this:
if (breadcrumb.hasOwnProperty(key)) {

which appears to have sorted out the issue.

I am not sure if this will help anyone, but it is a useful thing to know as it left me scratching my head for a little while.

I can create a patch for this if anyone else finds this useful.

CommentFileSizeAuthor
#1 jquery.drilldown.js_.patch487 bytesjurgenhaas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jurgenhaas’s picture

Version: 6.x-2.0 » 7.x-2.x-dev
Category: feature » bug
Status: Active » Needs review
FileSize
487 bytes

This happened to me as well (see #1277678: JavaScript Error in aloha.js) and attached is a patch (against the D7 version of this module) and it would be great if that could be submitted by the maintainer.

paulgemini’s picture

@Jurgenhaas: Your patch looks a bit off to me. I'm using the latest branch of Admin and here's what the code looks like, starting at line 78:

// Render the breadcrumb to the target DOM object
if (breadcrumb.length > 0) {
var trail = $(settings.trail);
trail.empty();
var numberOfCrumbs = breadcrumb.length;
for (var key = 0; key < numberOfCrumbs; key++) {
if (breadcrumb.hasOwnProperty(key) && breadcrumb[key]) {
// We don't use the $().clone() method here because of an
// IE & jQuery 1.2 bug.

jurgenhaas’s picture

My appologies, I missed the latest changes in the dev release and my patch was indeed based on 7.x-2.0-beta3.

However, I downloaded the latest dev release just now and that looks like this:

        // Render the breadcrumb to the target DOM object
        if (breadcrumb.length > 0) {
          var trail = $(settings.trail);
          trail.empty();
          for (var key in breadcrumb) {
            if (breadcrumb[key]) {
              // We don't use the $().clone() method here because of an
              // IE & jQuery 1.2 bug.

So I guess the code in comment #2 is not committed yet, is it?

skwashd’s picture

Status: Needs review » Needs work