Leak-free JSONP!

Leak-free JSONP!


Hey guys, I just got a new JSONP download technique working that is
leak-free in IE and Firefox. It's based on a suggestion by Gregory Collins
to do the JSON downloads in temporary hidden iframes:
http://mg.to/2006/01/25/json-for-jquery#comment-2254
I've been testing it by downloading a 250KB JSON file a hundred times. That
makes leaks pretty obvious - IE was shooting up to 328MB before I fixed the
leaks! Now there's not even a hint of a leak (after considerable tinkering).
Unlike my old JSONP plugin, this code doesn't require those crazy
uncacheable randomized URLs, and it doesn't put *anything* in the global
namespace. You can even do simultaneous multiple downloads from JSONP
services that have hard-coded callback function names with no problem,
because each download happens in its own iframe. (A case in point was the
Flickr JSONP feed API, which until recently used a hard coded callback
name.)
I have a few more things to do on it - need to add support for my cacheable
stringized JSONP (JSONSP) format that I use at Zvents, and test Safari and
Opera, etc.
I'll have a preview up soon, just got so excited about how well it's working
that I wanted to share the news. This will make my Zvents widgets *much*
more memory-friendly.
John, you were talking about adding JSONP support to the core for 1.2. This
may be just the ticket for that. Let me finish getting it running as a
plugin for 1.1.x and then we can kick around how to integrate it.
-Mike