2013-10-14 109 views
2

我想在Joomla中使用strophe.js!为xmpp聊天客户端,但它给了我这个错误。strophejs与mootools冲突

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 

有什么办法解决这个冲突吗?或者是否有任何替代strophe.js?

+1

请将urs添加到stophe.js,一些实例化它的代码以及它运行的代码(dom等),未缩小。否则,这个问题是无法回答的。 –

+1

其实我已经解决了这个错误。刚刚用最新版本取代了mootools。我应该删除这个问题吗? – vcxz

+0

当然,要投票结束。如果您认为这会被其他人遇到,请添加原始版本的mootools以及您在自己的答案中替换它的版本 –

回答

2

我试图用mootools.js使用strophe.js。 这是因为冲突绑定函数。 Strophe和mootools,都试图覆盖这个核心的JavaScript函数。 但是,当您使用较旧的mootools版本或具有向后兼容性的新mootools时,会出现此问题。 我在使用mootools版本1.4.5(最新版本),但在Joomla 2.5中向后兼容版本。所以我刚刚下载了具有相同版本号的新款mootools,但不包括版本1.3和1.2的兼容性。现在它的工作。

所以我猜的strophe不与MooTools的< 1.4> = 1.4版本的向后兼容性工作。

如果你想在mootools中使用strophe,你必须使用新版本,而且不要向后兼容。