I can't provide a complete answer to your question but I can show you why you are getting an 'Invalid argument' error.
In short, IE is trying to set the width of an element to "NaNem"
. Attempting to do this will cause IE to generate an "Invalid argument" error.
But why is IE trying to set the width of this element to this nonsensical value? This width first appears in a function within the supersubs plugin. The following code attempts to find the width of an em-dash in the current font ($$
contains a <ul>
element):
var fontsize = $('<li id="menu-fontsize">—</li>').css({
'padding' : 0,
'position' : 'absolute',
'top' : '-999em',
'width' : 'auto'
}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
However, IE calculates fontsize
as 0.
Later on, the value of this variable is used:
var emWidth = $ul.add($LIs).add($As).css({
'float' : 'none',
'width' : 'auto'
})
// this ul will now be shrink-wrapped to longest li due to position:absolute
// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
.end().end()[0].clientWidth / fontsize;
It seems clientWidth
here is also 0, and so this gives emWidth
the value NaN
.
Finally, the following adds an 'em' unit to emWidth
(hence NaNem
) and attempts to set the width of a <ul>
to "NaNem"
. IE isn't having this and gives you the 'Invalid argument' error:
emWidth += 'em';
// set ul to width in ems
$ul.css('width',emWidth);
However, I'm afraid I cannot say why IE is returning 0 for fontsize
. I'd hazard a guess at a potential bug in the supersubs plugin - perhaps it would be worth asking about this on the jQuery forums, or, as the supersubs plugin itself suggests, the jQuery Google Group?