Opened 15 years ago
Closed 15 years ago
#2245 closed bug (worksforme)
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.
Change History (6)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Do you have a simple test case that causes it? I've never seen this happen myself.
comment:3 Changed 15 years ago by
I've put a version here: http://www.boxatricks.com/jquery_bug/template-membership.htm
comment:4 follow-up: 5 Changed 15 years ago by
Milestone: | 1.2.2 → 1.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".
comment:5 Changed 15 years ago by
Thanks, I really appreciate your help. Still very much the JS novice.
Replying to 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".
comment:6 Changed 15 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Quite welcome. Glad your problem was fixed.
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