drupal, Jquery plugins and IE6/ IE7
I have a number of Jquery plugins being called through my Drupal Acquia Marina theme .info file.
They work fine in all popul开发者_JS百科ar browsers with the exception of IE6 and IE7, in which they don't appear to load at all.
Some of the plugins are very basic, like the following slidetoggle, which like all of them, exists as a a .js file referenced in a .info script call -
$(document).ready(function()
{
//hide the all of the element with class msg_body
$(".collapse-content").hide();
//toggle the componenet with class msg_body
$(".collapse-head").click(function()
{
$(this).next(".collapse-content").slideToggle(400);
});
});
Another is even more simple -
$(document).ready(function()
{
$(".principal-input").hide();
}
);
The others are a slightly adapted version of the jstree nested list tool, a tablesorter and two variants on collapsible checkbox/radio trees.
I'm at a loss as to how to further trouble-shoot the problem without firebug-type diagnostic tools, but am assuming that these scripts aren't loading at all, as there is no behavior visible.
The only error I get in either IE6 or IE7 is
Line: 3
Char: 3
Error: Object doesn't support this property or method
Code: 0
I've rattled through the code and don't think that is likely that all plugins are suffering from the last comma of death (http://stackoverflow.com/questions/2562736/jquery-ui-accordion-degrades-in-ie6-or-ie7-but-is-working-in-ie8).
One exception is the TinyMCE plugin, which still functions with IE6 and IE7. Given the density of the TinyMCE code and my lack of experience, I haven't been able to work out why TinyMCE is unaffected. It is called from the .info file in the same manner.
It is entirely possible that this has little to do with Drupal, and is an issue with Jquery alone, but any opinion on why this might be happening would be appreciated. Thanks, William.
After using IE8 developer tools and running in IE7 mode, I was able to pinpoint the issue.
Tablesorter was throwing an error that stopped all my other plugins in their tracks.
Line 24 of jquery.tablesorter.pager.js reads
top: o.offset().top + o.height() + 'px',
Removing the ending comma solves the problem. Tablesorter (and consequently all other plugins loaded after) now function in IE6 and IE7.
I would try going to admin/settings/performance and make sure Optimize Javascript Files is enabled. My guess is that IE is limiting the number of JS files you call.
精彩评论