Hi all..
When ATLAS is used, client controls can be accessed using $(controlId) which is equivalent to document.getElementById(controlId). Unfortunately, I have other script in the same page that uses "$" as an internal variable, causing, obviously, confict.
Is there a way to change "$" function name. I tell you beforehand that it's impossible to make such a change to the other script (which is a third party commercial script).
Any help or suggestion would be greatly appreciated,
Thanks
Jaime
Well, the "$" is a javascript shortcut for document.getElementById (as you stated) and this would be a LOT more difficult to change than your 3rd party change, if it can even be changed at allReally? so I am stuck then, because the third party script is very very big, and $ is being used intensively. It is used as part of other variables, part of other functions and alone. I would need to detect when it is used alone and replace only that entry. As you see, it will be very easy to make mistakes.
As you said, $ is a shortcut for document.getElementById, but it is not original from JavaScript, it was defined in WebResource.axd file by ATLAS assembly. That's why I was believing that it was possible to change before the page was rendered.
Jaime
Hi Jaime,
It might be possible to create a super function which contains the functionality for both of the "$" functions and intelligently switches logic based on the parameter passed in. For example, the Atlas function is only expecting a single parameter. If the function in your third party code is expecting more than one parameter, you might be in business. You can also check to see whether the type of parameter is different.
What does the "$" function in your third party framework do? Can you give a quick overview of the function prototype, what parameters it expects and what value it returns?
-Tony
The "$" defined in the other script isn't a function but a variable.
The script implements a very complete DHTML menu, so you can imagine how complex is the programming of it.
The direct effect this problem has over the execution of the page is that, in place of each menu options, several "function $(elementID) { return document.getElementById(elementID); }" appear. It seems that the third party script is using precisely variable "$" to render menu options.
Jaime
Ok, that makes things much more complicated. I would expect that the third party library would be a little easier to modify than Atlas though. See if you can do a simple search and replace on "$" in the script to replace it with something like "$$"
Hope this helps,
Tony
hello.
well, it seems like your javascript library is being inserted on the page before the atlas files. btw, if don't need to use the atlas controls and xml-script, then including only the runtime components will not define the $ function.
it also looks like you're inserting the menu file before the atlas file. if you change the order, then $ will have the "correct" value and atlas will work ok too since i think it doesn't use that method internally.
No comments:
Post a Comment