The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

TypeError: cannot convert to object

Forums » General Opera topics » Opera extensions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

25. October 2011, 12:34:21

frankdd89

Posts: 96

TypeError: cannot convert to object

Hi everyone, i'm developing an extension to get rid of ads for hotmail mail service, the extension actually works but it is not passing the moderation because of this error:

Uncaught exception: TypeError: Cannot convert 'elem' to object


this is the piece of code that generates the exception:
var elem = document.getElementById('MainContent');
elem.style.right = '0px'; //this line generate the exception

the weird thing is that the style is correctly modified, i do not understand what is wrong, can anyone help me?
EDIT: For now i've fixed it surrounding with a try catch statement

26. October 2011, 05:48:42

Opera Software

daniel

Mac product tester, Opera Software

Posts: 1287

Same solution to the same problem as yesterday. Check that the object exists.
I sent a pull request for the patch on Github.

(See! I said it would be easier to contribute once it was on Github.)

28. October 2011, 11:38:01

frankdd89

Posts: 96

Originally posted by daniel:

Same solution to the same problem as yesterday. Check that the object exists.
I sent a pull request for the patch on Github.

(See! I said it would be easier to contribute once it was on Github.)


Did it, added some nice feature too! This are my very first javascript codes, but Opera's error terminal it is a very powerful debugging tool!

28. October 2011, 12:45:52

Opera Software

daniel

Mac product tester, Opera Software

Posts: 1287

Originally posted by frankdd89:

Opera's error terminal it is a very powerful debugging tool!


I would recommend you spend some time with Opera Dragonfly. Break points will let you step trough your code and find out exactly what your code is up to, for example. It is an excellent tool.

Forums » General Opera topics » Opera extensions