works fine, after changing the line 73:
.attr('id') to .attr('class')

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tbee’s picture

after upload to server appears this bug again...
if you enter the page with not selected any from the tabs, there will be a script error in IE7 and older...
after you select any from tabs and refresh browser, everything's fine...

can anyone help ?

tbee’s picture

I could only fix the bug entering the id...

example:

var id = $('a[@href*="'+ fragment +'"]')
.parent() // the parent li
.parent() // the parent ul
.parent() // the parent div (the actual tabset div!)
.attr('id')
.substr("tabs-".length);
updateLinks(id, fragment);

to

var id = "mini-panels-minipanels";

where "minipanels" is the id of my element in drupal...

aasarava’s picture

Status: Active » Needs review
FileSize
998 bytes

I've submitted a patch that seems to resolve this issue.

The problem is that when the URL contains just the site domain and no path (i.e., the home page), the call to currentURI.indexOf('#') evaluates to -1. In other words, there is no # in the current URI, because there is no path in the URI.

Unfortunately, the JavaScript error that gets thrown down the line because of this also prevents other JavaScript code from executing -- so you can end up having problems in other modules, like we did on a recent project with simplemenus.

My solution was to include a check to make sure the indexOf call is > -1 before processing further:

// Update all links on load (automatically find the name of the tabset!).
var currentURI = "" + window.location;
var poundIdx = currentURI.indexOf('#');
if(poundIdx > -1) {
  var fragment = currentURI.substr(poundIdx);
  var id = $('a[@href*="'+ fragment +'"]')
  .parent() // the parent li
  .parent() // the parent ul
  .parent() // the parent div (the actual tabset div!)
  .attr('id')
  .substr("tabs-".length);
  updateLinks(id, fragment);
}

Hope that helps.

tbee’s picture

thanks a lot!
it works fine now ;)

hargobind’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

Tested, and works great. Thanks!

Unfortunately, the JavaScript error that gets thrown down the line because of this also prevents other JavaScript code from executing -- so you can end up having problems in other modules, like we did on a recent project with simplemenus.

aasarava is correct... this bug not only fails for the Panels_Tabs module, but it also has the potential to break all other scripts on the page. I'm suggesting this bug be moved to Critical priority and pushed as a new release because of it's effect on other functions of the site.

aasarava’s picture

Excellent. Happy to help.

Wim Leers’s picture

I'll get this in tomorrow.

phacts’s picture

I applied this patch to panels_tabs.js, and it works quite well. However, in one case it does not - I have a mini-panel that consists of comments and the comment form. When I post a comment, Drupal automatically sends me to example.com/page-name#new. The #new bit was causing the original error to recur, so I came up with a fairly ugly solution:

        var poundIdx = currentURI.indexOf('#'); // added
	if (poundIdx > -1) { // added
	    var fragment = currentURI.substr(currentURI.indexOf('#'));
	    var test_id = $('a[@href*="'+ fragment +'"]')
	    .parent() // the parent li
	    .parent() // the parent ul
	    .parent() // the parent div (the actual tabset div!)
	    .attr('id');
		if (typeof(window[test_id]) != "undefined") { // my additional patch
			var id = $('a[@href*="'+ fragment +'"]')
			.parent() // the parent li
			.parent() // the parent ul
			.parent() // the parent div (the actual tabset div!)
			.attr('id')
			.substr("tabs-".length);
			updateLinks(id, fragment);
		}
	}

I don't consider my javascript skills to be all that good, so I don't know if this is good enough to patch for others, but someone might want to take a look at this and potentially suggest a better solution...? Either way, I've tested this, and it works.

steveoliver’s picture

Thanks, aasarava!

Wim Leers’s picture

Title: script error 'parent().parent().parent().attr(...)' is null or not an object » Fragment checking
Assigned: Unassigned » Wim Leers
Status: Reviewed & tested by the community » Needs review
FileSize
1.32 KB

I'm ashamed that it took me so long to get back to this. I've handed over the 6.x version to dereine and am now cleaning up the issue queue for 5.x.

Please review the following patch, which implements aasarava's bugfix and phacts' extension of that, but in a cleaner way.

crea’s picture

I had problems with 6.x version sometimes throwing error in IE, something about parent elements, and this patch removed this error.

moonray’s picture

Status: Needs review » Reviewed & tested by the community

I can verfiy that the patch fixes the problem for IE in version 6 as well.

ptoly’s picture

I'm afraid this problem continues with me, even after the patch.

I have a tabbed page with a mini panel as the default landing view. On some pages the top block of the mini panel shows up but the two column mini panels underneath fail to appear. On another page the whole page fails to appear until I click on another tab and come back.

After running the patch I don't get the script error 'parent().parent().parent().attr(...)' is null or not an object error in the console but the mini-panels don't appear until I click on a tab and click back.

I can also get the content to appear by modifying the CSS using IE dev toolbar.

This is only in IE 7. I don't see any js errors in FF PC or Mac or in IE 8, for that matter.

EDIT:
Please disregard this post. It does not belong here. Patch worked fine. This is an issue with rounded corners in IE7.

Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the feedback. Committed!

- D6: http://drupal.org/cvs?commit=275152
- D5: http://drupal.org/cvs?commit=275154

Status: Fixed » Closed (fixed)

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