views:

50

answers:

3

i read this statement from a book i read

The Document Object Model or DOM is really not a part of JavaScript but a separate entity existing outside it. Although you can use JavaScript to manipulate DOM objects, other scripting languages may equally well access them too.

what is the best way to avoid conflict between javascript and other client-siede scripting language when we have to deal with XMLHTTPRequest object

+1  A: 

There are no other significant client-side scripting languages you'd need to worry about. The few other things that might modify the DOM on a normal web page are so obscure you'd know if you were using them. You can assume you have exclusive access to the DOM.

Matti Virkkunen
+2  A: 

This is not a common occurrence.

Are you using any other client-side languages on your site? If you do not have any flash, silverlight, ActiveX, etc running around then there is nothing to worry about.

And even if you are, just make sure they are not manipulating the same section of the DOM - which you would probably be doing anyway.

Justin Ethier
+1  A: 

If you can't be sure about which other scripts there are on the same page, that could manipulate the same DOM, then it probably doesn't matter, if they're written in a different language. The problem is then, that there are other scripts - JavaScript or not.

I'd use a top level object with a unique name, and put all my things under that object. This way, name conflicts are less likely.

Chris Lercher