Came here to point out this problem – my fault for not checking carefully through all the threads first!
It would be better if the wrox ‘dowload code’ link went to the GIT repo as I just assumed it must be the most recent from the official site.
The issue makes the example unusable when your xmpp server hostname is an IP address. As '.' is an illegal attribute character it adds a new tab each time on_message is called as $('#chat-' + jid_id).length always resolves to 0.
As a slight improvement you could use:
Code:
.replace(/[.@]/g, "-")
to replace all the characters with one call to replace
or safer:
.replace(/[^\w]/g, "-")
to protect against usernames with illegal attribute chars in like tes^[email protected]