Skip to main content

Bug Tracker

Side navigation

#2245 closed bug (worksforme)

Opened January 28, 2008 03:52PM UTC

Closed February 21, 2008 09:55PM UTC

getComputedStyle throwing error in all browsers

Reported by: cloudsteph Owned by:
Priority: major Milestone: 1.2.4
Component: core Version: 1.2.2
Keywords: getComputedStyle Cc:
Blocked by: Blocking:
Description

Error reporting in FF2, IE7, IE6, Safari 4. Not using the curCSS function at present in my webpages so unsure if it is affecting the function itself but it does cause error pop-ups to appear in IE6 while preventing code from validating in all browsers.

Error details reported in Firebug while running JQuery 1.2.2 [uncompressed version]:

uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: file:///Y:/IGS/Programming/Site/www/templates/js/jquery-122min.js :: anonymous :: line 22" data: no]

Line 0

Not sure if http://dev.jquery.com/ticket/1779 or http://dev.jquery.com/ticket/1661 are related as I've tried applying fixes for both to this issue without success.

Attachments (0)
Change History (6)

Changed February 14, 2008 12:00PM UTC by cloudsteph comment:1

This error is now also appearing in 1.2.3.

uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: file:///Y:/IGS/Programming/Site/www/templates/js/jquery-1.2.3.js :: anonymous :: line 876" data: no]

Line 0

Changed February 14, 2008 03:24PM UTC by davidserduke comment:2

Do you have a simple test case that causes it? I've never seen this happen myself.

Changed February 20, 2008 04:51PM UTC by cloudsteph comment:3

Changed February 20, 2008 09:35PM UTC by davidserduke comment:4

milestone: 1.2.21.2.4

Testing in IE this bug is in your code in your init() function.

function init(){
 var divArray = new Array("detail_1", "detail_2", "detail_3", "detail_4","hide_1","hide_2","hide_3","hide_4");

 for(i=0;i<=8;i++){
   var theElement = document.getElementById(divArray[i]);
   $(theElement).hide();
 }
}

If you look you'll see your array has 8 elements but your loop goes from 0 to 8 inclusive. So what happens on the last loop is the getElementById returns null and $(null) == $(document) so it is trying to hide the document element itself which fails since it has no 'style' property.

Try changing your code to "< 8" instead of "<= 8" or probably better "< divArray.length".

Changed February 21, 2008 10:10AM UTC by cloudsteph comment:5

Thanks, I really appreciate your help. Still very much the JS novice.

Replying to [comment:4 davidserduke]:

Testing in IE this bug is in your code in your init() function.
> function init(){
>  var divArray = new Array("detail_1", "detail_2", "detail_3", "detail_4","hide_1","hide_2","hide_3","hide_4");
> 
>  for(i=0;i<=8;i++){
>    var theElement = document.getElementById(divArray[i]);
>    $(theElement).hide();
>  }
> }
> 
If you look you'll see your array has 8 elements but your loop goes from 0 to 8 inclusive. So what happens on the last loop is the getElementById returns null and $(null) == $(document) so it is trying to hide the document element itself which fails since it has no 'style' property. Try changing your code to "< 8" instead of "<= 8" or probably better "< divArray.length".

Changed February 21, 2008 09:55PM UTC by davidserduke comment:6

resolution: → worksforme
status: newclosed

Quite welcome. Glad your problem was fixed.