What the heck is..

uncaught exception: [Exception… “Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: PATH_TO_MY_JAVASCRIPT_FILE :: THE_METHOD_NAME :: line #” data: no]

For me it was just an appendChild() that was causing the problems. You can always try the innerHTML+= way if all else fails 😉


4 Comments

Bubuletz · July 7, 2011 at 08:27

got this too, but after I looked more carefully I noticed the problem. the code was:

var a = document.createElement(“a”);
a.appendChild(‘hello world’);

someDiv.appendChild(a);

Problem is at line 2. The correct way is:
a.appendChild(document.createTextNode(‘hello world’));

    Andrew · July 7, 2011 at 10:07

    Thanks for your comment on this issue!

    As you have noticed a string is not a valid DOM element and should rather be used within an actual element like the TextNode you instantiated it on.

dali · June 24, 2011 at 12:22

same ! FFS

??????? · December 4, 2010 at 07:31

The same problem

Leave a Reply

Your email address will not be published. Required fields are marked *