DWR 2.x implementation of the $ function does not safely check if the name is already bound in Internet Explorer

Description

Note: this is fixed in version 3.x

In the 2.x code stream the $ function is defined like this:

var $;
if(!$){
//alias dwr.util.byId
}

Unfortunately this does not work in Internet Explorer as the "var $;" actually re-defines the $ function to "nothing", which then makes the if test true, and thus $ is re-defined to alias dwr.util.byId

For developers using jQuery, Prototype, etc. that use the $ as a primary function, including DWR's util.js after jQuery/Prototype works in Firefox etc. but it will fail in IE.

The definition of the (now deprecated) $ function in DWR 3.x is correct and the 2.x version should be changed to match.

if(window['$'] == null){
$ = dwr.util.byId;
}

This safely tests (without throwing errors) if the $ identifier has already been allocated, and only if it hasn't aliases dwr.util.byId accordingly.

Activity

Show:
David Marginian
January 18, 2010, 10:53 AM

Mike do you have any issues with me making this change? I am assuming we just made the change to 3.x and forgot to make it is 2.x.

David Marginian
January 27, 2010, 6:16 PM

Mike, lets get this in and then push out 2.0.6.

David Marginian
January 27, 2010, 6:45 PM

I just took a look. This was actually fixed last March by Mike. This will be in 2.0.6 which is going to be released soon.

Assignee

David Marginian

Reporter

Stephen Cunliffe

Labels

None

Documentation Required

No

Components

Fix versions

Affects versions

Priority

Normal
Configure