我正在尝试在 Joomla 中使用 strope.js!对于 xmpp 聊天客户端,但它给了我这个错误。
Uncaught TypeError: Cannot read property 'id' of undefined strophe.js:3046
Strophe.Connection._onRequestStateChange strophe.js:3046
(anonymous function) mootools-core.js:88
(anonymous function) mootools-core.js:88
Strophe.Connection._processRequest strophe.js:2954
Strophe.Connection._throttledRequestHandler strophe.js:3022
Strophe.Connection.connect strophe.js:2399
conn.connect index.js:85
LoginPanel.Backbone.View.extend.connect converse.js:2761
LoginPanel.Backbone.View.extend.authenticate converse.js:2811
bound underscore.js:592
x.event.dispatch jquery.js:5095
v.handle
有什么办法可以解决这个冲突吗?或者有 strope.js 的替代品吗?
最佳答案
我尝试将 strope.js 与 mootools.js 一起使用。 这是因为绑定(bind)函数冲突。 Strope 和 mootools 都试图重写这个核心 javascript 函数。 但是,当您使用较旧的 mootools 版本或具有向后兼容性的新 mootools 时,就会出现此问题。 我使用的是 mootools 版本 1.4.5(最新版本),但在 Joomla 2.5 中向后兼容版本。所以我只是下载了具有相同版本号的新mootools,但不包括1.3和1.2版本的兼容性。现在它可以工作了。
所以我猜 strope 不适用于 mootools 版本 < 1.4 和 >= 1.4 并向后兼容。
如果您想将 strope 与 mootools 一起使用,您必须使用不向后兼容的较新版本。
关于jquery - stropejs 与 mootools 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19357292/