document.getElementById() returns null when using mozrepl (but not in firebug)

Posted by teamonkey on Stack Overflow See other posts from Stack Overflow or by teamonkey
Published on 2010-03-21T03:57:32Z Indexed on 2010/03/21 4:01 UTC
Read the original article Hit count: 531

I'm trying to use the mozrepl Firefox extension to give me a Javascript REPL from within emacs.

I think I've got it set up correctly. I can interact with the REPL from emacs and can explore the document pretty much as described in the tutorial pages. The problem comes when I try to do something really simple, like get a context to a canvas element:

repl> document.getElementById("mycanvas").getContext("2d")
!!! TypeError: document.getElementById("mycanvas") is null

Details:

  message: document.getElementById("mycanvas") is null
  fileName: chrome://mozrepl/content/repl.js -> file:///C:/Users/teamonkey/AppData/Roaming/Mozilla/Firefox/Profiles/chfdenuz.default/mozrepl.tmp.js
  lineNumber: 1
  stack:
    @chrome://mozrepl/content/repl.js -> file:///C:/Users/teamonkey/AppData/Roaming/Mozilla/Firefox/Profiles/chfdenuz.default/mozrepl.tmp.js:1
  name: TypeError

It's not just that particular instance: any call to getElementById will just return null.

If I start up firebug I can enter the same thing and it will return a valid context, but I'd really like to get the REPL working in emacs. I don't think this is a bug but I've probably not configured mozrepl correctly. Can anyone help?

Mozrepl 1.0, Firefox 3.6

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox3.6