This is the final answer: eliminating a tempting but incorrect answer to help others move to the correct answers.
Debugging might seem to cause a problem. However, the only browser that has a problem is IE, and in IE you can only debug code that was part of the original document. For dynamically added code, the debugger simply shows the body element as the current instruction, and IE claims that the error occurred on a huge line number.
Here is an example webpage that will demonstrate this problem in IE:
<html> <head> <title>javascript debug test</title> </head> <body onload="attachScript();"> <script type="text/javascript"> function attachScript() { var s = document.createElement("script"); s.setAttribute("type", "text/javascript"); document.body.appendChild(s); s.text = "var a = document.getElementById('nonexistent'); alert(a.tagName);" } </script> </body>
This gave me the following error:
Line: 54654408 Error: Object required
ErikE Jan 27 '10 at 19:52 2010-01-27 19:52
source share