"document" in mozilla extension js modules?

I am building Firefox extension, that creates single XMPP chat connection, that can be accessed from all tabs and windows, so I figured, that only way to to this, is to create connection in javascript module and include it on every browser window. Correct me if I am wrong... EDIT: I am building traditional extension with xul overlays, not using sdk, and talking about those modules: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules So I copied Strophe.js into js module. Strophe.js uses code like this: /*_Private_ function that creates a dummy XML DOM document to serve as * an element and text node generator. */ [---] if (document.implementation.createDocument === undefined) { doc = this._getIEXmlDom(); doc.appendChild(doc.createElement('strophe')); } else { doc = document.implementation .createDocument('jabber:client', 'strophe', null); } and later uses doc.createElement() to create xml(or html?) nodes. All worked fine, but in module I got error "Error: ReferenceError: document is not defined". How to get around this? (Larger piece of exact code: http://pastebin.com/R64gYiKC )

以上就是"document" in mozilla extension js modules?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准