2013-10-14 107 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,你必須使用新版本,而且不要向後兼容。