Hi, I'm using NiceMenus in Drupal 6.2 which works fine in Firefox, but errors out in IE v7.0.6000.16643. When a flyout is activated IE throws the following error message:
A Runtime Error has occured.
Do you wish to debug?
Line: 7
Error: Object doesn't support this property or method.
[Yes][No]
Click the No button and a second error message pops up, identical to the first except the error is on Line 9.
Any ideas?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | nice_menus.js_.txt | 1.59 KB | wilco67 |
Comments
Comment #1
add1sun commentedI don't know enough about JS to figure out why you are getting that since no one else has reported it. Do you have any other JS running on the page (other than drupal.js)?
Comment #2
jwcdyntek commentedHi, I am also using NiceMenus in Drupal 6.2 and it works fine in firefox, shows up in IE 7.0.5 , but has errors that Object doesnt support this property or method line 10 and the submenus do not show up at all in IE 6.0.29 but has the same errors as in IE 7.05. I am pretty sure it has to do hovering over the menu items.
Comment #3
cosmicdreams commentedI am experiencing this same problem. I have:
Drupal 6.2
Nice Menus 6.x 1.1
IE 7.0.5730.11
FF 2.0.0.14
I get the same error as listed above. And thought it might be related to the variable naming issue listed here
Comment #4
cosmicdreams commentedScript Debugger says that the error is on this line:
nice_menus.js : line 7
$(this).addClass("over").find("> ul").show().addShim();
The full function is this:
Comment #5
cosmicdreams commentedI figured out that it was the addShim() on lines 7 and 8 that caused the bug. However, removing those functions did not allow the drop downs to appear properly.
It could be a weird layout issue with IE here. When I gave the menuparent's ul a left and top of 0 it the first item appeared over the anchor that I hovered. Doing that showed me that nearly everything had a higher z-index. Perhaps there is a z-index: -1 applied somewhere?
Comment #6
wilco67 commentedI have had the same issue, and worked something out. to me it looks like that the function is not a valid call for IE.
the function itself needs to be defined still, it is called from other places.
this is the new function definition and it works fine for me now. also for IE and firefox, no issues with display or behaviour anymore. ( attached i have the new nice_menus.js file; just handy for some. just remove the _.txt extention )
---------------------
if (document.all) {
function IEHoverPseudo() {
// $("ul.nice-menu li.menuparent").hover(function(){
// $(this).addClass("over").find("> ul").show().addShim();
// },function(){
// $(this).removeClass("over").find("> ul").removeShim().hide();
// }
// );
// Add a hover class to all li for CSS styling. Silly naming is done
// so we don't break CSS compatibility for .over class already in use
// and due to the fact that IE6 doesn't understand multiple selectors.
$("ul.nice-menu li").hover(function(){
$(this).addClass("ie-over");
},function(){
$(this).removeClass("ie-over");
}
);
}
// This is the jquery method of adding a function
// to the BODY onload event. (See jquery.com)
$(document).ready(function(){ IEHoverPseudo() });
}
Comment #7
vanauslo commentedAll right it works properly now in IE 7 in Windows XP with Drupal 5.
Comment #8
cosmicdreams commentedI agree wilco: I was also able to decipher that addShim() and removeShim() were the culprits in producing this error for me. Instead of doing the alteration you've written, I just removed those two functions from the js file and was able to proceed.
Comment #9
add1sun commentedHrm, well this is sucky that the shim is causing issues all of the sudden since it has been happily working for quite a while. The shim is needed in IE6 so that the menus will work properly over form selects so hopefully someone with JS know-how can figure out how to fix it vs. getting rid of it.
Comment #10
cosmicdreams commented@ add1sun: Also of importance is why this error occurs within this theme and not in other themes (garland). Could it be related to the duplicative variable naming issue I linked above?
Comment #11
add1sun commentedHrm, well there are no HTML form IDs of addShim or removeShim that I'm aware of so that doesn't seem quite right.
Comment #12
dinaiz commentedThe easiest way (which works) to fix the issue is ...to ignore it ! I added a try-catch block around the guilty lines, with an empty catch, and everything works, except the highlighting, but this is not that important, at least for me.
Here's the code :
Comment #13
add1sun commentedThere is now an issue to remove the JS from IE 7 altogether (#269857: Remove JS from IE 7) but I need testers for some related issues in order to do that:
#136702: Disappearing links in IE 7.0
#235562: jQuery gets reloaded by drupal_add_js
Comment #14
add1sun commentedAll of the patches from the above issues have been added to the dev versions (for 5 and 6). Please test these new devs to see if that fixes the problem. They basically fixed the CSS issue and removed JS from IE 7.
Comment #15
add1sun commentedClosing this as fixed since no reports back.
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
jreashor commentedThis error is still present in IE6. The addShim and removeShim methods are declared outside of the document.ready function, making them out of scope. The code should be updated as such:
// $Id: nice_menus.js,v 1.5.2.10 2008/08/04 23:46:09 add1sun Exp $
// We need to do some browser sniffing to weed out IE 6 only
// because only IE6 needs this hover hack.
if (document.all && !window.opera && (navigator.appVersion.search("MSIE 6.0") != -1) && $.browser.msie) {
$(document).ready(function(){
$("ul.nice-menu li.menuparent").hover(function(){
$(this).addClass("over").find("> ul").show().addShim();
},function(){
$(this).removeClass("over").find("> ul").removeShim().hide();
}
);
$.fn.addShim = function() {
return this.each(function(){
if(document.all && $("select").size() > 0) {
var ifShim = document.createElement('iframe');
ifShim.src = "javascript:false";
ifShim.style.width=$(this).width()+1+"px";
ifShim.style.height=$(this).find("> li").size()*23+20+"px";
ifShim.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
ifShim.style.zIndex="0";
$(this).prepend(ifShim);
$(this).css("zIndex","99");
}
});
};
$.fn.removeShim = function() {
return this.each(function(){
if (document.all) $("iframe", this).remove();
});
};
});
}