views:

117

answers:

3

When viewing a site I am working on in any version of IE, I get a done with errors message and the only thing that seems to load is the background. Really not sure how to go about fixing this one, I am not even sure what the error means.

The error is an invalid argument on line 117.

It works fine in Firefox, Safari, and Chrome.

Here is the URL: http://streamlinehome.com/wordpress/

A: 

Try putting a '' around the file name.

    #header {
        background-image: url(images/header-plain.png);
    }

w3schools' example shows a quoted file name: http://www.w3schools.com/css/pr_background-image.asp

del.ave
Has nothing to do with CSS
epascarello
+1  A: 

117 points to the jQuery file. Debugging the code the error occurs in if(e)f[b]=d;

  • b is "width"
  • d is "NaNem"

Stepping back on the CallStack you are calling the jQuery method here

line 63 in supersubs.js:

$ul.css('width',emWidth);

Looking up a few lines you see a comment about clientWidth and that is probably where the troubles begin. :)

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;
 // add more width to ensure lines don't turn over at certain sizes in various browsers

So looking at it some more the line ...end()[0].clientWidth returns 0 and fontsize = 0 so you have 0/0 which is NaN

epascarello
So the bug is in your supersubs.js plug-in. :) Don't you just love 3rd party code.
epascarello
+1  A: 

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">&#8212;</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?

Pourquoi Litytestdata