The functionality on Drupal.quicktabs.tab() does not seem to function correctly for me on a Drupal Commons install with jQuery 1.5.2 installed (fyi, commons is using an unmodified 7.x-3.6 version of the module).

Specifically:

// Constructor for an individual tab
Drupal.quicktabs.tab = function (el) {
  this.element = el;
  this.tabIndex = el.myTabIndex;
  var qtKey = 'qt_' + el.qt_name;
  var i = 0;
  for (var i = 0; i < Drupal.settings.quicktabs[qtKey].tabs.length; i++) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// this for loop is never used, because Drupal.settings.quicktabs[qtKey].tabs
// is an object, and .length does not appear to work on objects.
    if (i == this.tabIndex) {
      this.tabObj = Drupal.settings.quicktabs[qtKey].tabs[i];
      this.tabKey = i;
    }
  }
  this.tabpage_id = 'quicktabs-tabpage-' + el.qt_name + '-' + this.tabKey;
  this.container = $('#quicktabs-container-' + el.qt_name);
  this.tabpage = this.container.find('#' + this.tabpage_id);
}

On my install, I could not get tabs to do anything during a click event, and tracing through the stack I can see that the tabpage_id and tabpage were being set to undefined, because the tabObj and tabKey were never set correctly.

Comments

phillamb168’s picture

Status: Active » Needs review
StatusFileSize
new789 bytes

And here's a patch.

Status: Needs review » Needs work

The last submitted patch, 1: 2377331-javascript-does-not-support-lenght-on-objects.patch, failed testing.

phillamb168’s picture

Oops, my bad. Here's the patch again.

phillamb168’s picture

phillamb168’s picture

Status: Needs work » Needs review
phillamb168’s picture

Assigned: phillamb168 » Unassigned
jurcello’s picture

Works for me. Thank you.
Question to the maintainer: do you know why this could be an object and not an array?

sonicthoughts’s picture

working for several months. please commit.

droplet’s picture

Note that Object.keys won't work in IE8 and below.

nwom’s picture

Version: 7.x-3.6 » 7.x-3.x-dev
Status: Needs review » Fixed

.length is no longer used in the current dev version of the module. It appears this patch is no longer necessary.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.