I've found an old thread talking about the compatibility issue with json.js and jquery :
[ jQuery + Json library = broken jQuery ] http://groups.google.com/group/jquery-dev/browse_thread/thread/5aecf614042d5a20/5eacf4619d19a8a7?lnk=gst& q=json# Whenever json.js, which mess with Object.prototype, is included in a web page with jquery, two javascript errors are potentially awakened. As I think it is awful to workaround this problem by modifying all JSON related function calls or any other things that might have injected into Object, I decided to let jquery to be more fault tolerant to a given environment. Like how it did for cross browser support. The unified diff between jquery 1.3.2 and the changes I have made to avoid the errors: ============================================== --- jquery-1.3.2.js 2009-03-12 14:09:14.000000000 +0800 +++ jquery-1.3.2_fix.js 2009-03-12 14:15:38.000000000 +0800 @@ -1582,7 +1582,7 @@ while ( expr && set.length ) { for ( var type in Expr.filter ) { - if ( (match = Expr.match[ type ].exec( expr )) != null ) { + if ( Expr.match[ type ].exec && (match = Expr.match[ type ].exec ( expr )) != null ) { var filter = Expr.filter[ type ], found, item; anyFound = false; @@ -2683,6 +2683,9 @@ for ( var j in handlers ) { var handler = handlers[j]; + if ( !handler.guid ) { + continue; + } // Filter the functions by class if ( all || namespace.test(handler.type) ) { // Pass in a reference to the handler function itself ============================================== The first change avoided a problem in IE 5 that saying blahblahbalh method not found. The second change avoided an infinite recursion loop, though checking the existence of guid may still be vulnerable to coincidence. Perhaps adding a hopefully unique identifier(maybe the jQuery instance?) when an event is being added via jQuery.event.add() will be safer? I love jquery as it helped me much in not reinventing the wheels. Hopefully the fixes will be incorporated as part of the jquery so that the fixes can be shared by more people. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
