It doesn't require anything that I would call proxying, Yehuda - you just
need to get references to the correct window and document and use them
consistently.
 
Here's an Araxis Merge diff report of the patch that I was working on:
 
http://mg.to/jquery/iframe/jquery-iframe.html
 
If you want to look at it with a different diff program, the before and
after files are there too:
 
http://mg.to/jquery/iframe/jquery-1.2.6.js
 
http://mg.to/jquery/iframe/jquery-1.2.6-frame.js
 
Most of it was just changing all the hard coded references to document and
window to use private variables instead, and provide a way to initialize
those (in this test version, you define jQuery_window before loading
jquery.js and it uses that window).
 
I had this working nicely in an early version of my Google voter information
gadget. (I later ended up using a different gadget design that didn't
require this.) There were still a few loose ends, but all of the jQuery
functions that I was using were working fine.
 
I'll upload the test code a bit later, but I thought I'd put the
patch-in-progress up there since we're talking about it.
 
One big disadvantage of this approach is that it takes a second .js file to
load the main one into the iframe, and things like $(document).ready are
different. It's not really a drop-in replacement that would be compatible
with existing code. But if you change your code to work with it, it's a
great technique - it's worked very well for me in past projects.
 
-Mike



  _____  

From: Yehuda Katz
Sent: Friday, October 03, 2008 7:01 PM
To: jquery-dev@googlegroups.com
Subject: [jquery-dev] Re: Immunizing jQuery against enviroment changes


Michael, 

the iframe trick requires proxying of things like window, document, etc, no?

Whenever I've thought about it before it seemed prohibitively complex.

-- Yehuda


On Fri, Oct 3, 2008 at 6:41 PM, Michael Geary <[EMAIL PROTECTED]> wrote:


I suppose it's arguable what's easier - after all if it were *that* easy I
would have had that patch done already. :-) But I used the iframe trick on a
widget project where I needed to be compatible with just about any website
out there, and it really works well.



  _____  

From: Michael Geary

If you really want to protect against changes to native objects, load jQuery
into a private IFRAME. It's easier than all these tricks, and it gives
absolute protection.
 
I have 90% of a patch to do this - I know I promised it a while ago - been
kind of busy with election stuff for Google. But I'll finish it up soon, I
promise!
 
-Mike






-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to