XUpload - namespace conflict with mootools

Message
Author
eelco
Posts: 1
Joined: Apr 29, 2009 6:28 am

namespace conflict with mootools

#1 Postby eelco » Apr 29, 2009 6:36 am

I'm using xupload for an application that also uses mootools. The first function that is defined in the xupload script is a $ function that gets an element by its id.

Mootools uses the same name, to get an element by its id and create a mootools element object. Loading the xupload script therefore crashes all mootools based scripts.

Remedy was easy (just comment out the xupload $ function, xupload doesn't mind), but since mootools is widely used I would assume this problem to arise more often?

giorrrgio
Posts: 8
Joined: Aug 04, 2008 11:11 am

#2 Postby giorrrgio » May 13, 2009 1:10 pm

I think something like that would fix the issue:

Code: Select all

if(typeof window.$ != 'function') {
	var $ = new Function("elem", "return document.getElementById(elem)")
}