Yeah, I'm currently using jQuery in noConflict mode but am looking to
share code back and forth with other groups here at work.  They
develop in Prototype and my group develops in jQuery.  I was hoping to
find a way to constrain Prototype to the widgets that they develop so
that I could use their widgets without adding objects globally,
modifying function and arrays, etc.  Thanks for the heads up on caja,
I will take a look.

Josh Powell

On Mar 15, 11:20 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> FYI, Tobie's working on Prototype support for Google Caja[1], which is
> around doing exactly the sort of thing.  (Caja is Spanish for "box".)
> It's not released yet, but coming soon.  (And yes, "Google Caja" does
> read a bit like the name of an 80's one-hit-wonder on first
> glance. ;-)  Less so when spoken, since that 'j' is an 'h' sound [with
> a bit of throat] -- "CA-ha").
>
> Separately, remember that in addition to defining several symbols
> (usually at global scope), Prototype: 1. Modifies the prototypes of
> several things like Function, Array, and such; 2. Directly modifies
> globals like document, Object; and 3. (Where possible) Modifies the
> prototypes of some DOM elements.
>
> I have the impression that at the moment, the best way to use
> Prototype and jQuery in the same project is to use jQuery's no-
> conflict mode.[2]  (That doesn't mean you necessarily have to use
> "jQuery" instead of "$" everywhere, see the link for details on
> shorthand options.)
>
> [1]http://code.google.com/p/google-caja/
> [2]http://docs.jquery.com/Using_jQuery_with_Other_Libraries
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Mar 16, 4:01 am, Josh Powell <seas...@gmail.com> wrote:
>
> > First, thanks for the reply.  This seemed like it should work to
> > contain Prototype, but it doesn't...
>
> >   $(function() {
> >       console.log($('mySelect'));
> >       (function() {
> >               $.getScript('/cfgmgr/js/lib/prototype-1.6.0.3.js', function() 
> > {
> >                   console.log($('mySelect'));
> >               });
> >       })();
> >       console.log($('mySelect'));
> >       setTimeout("console.log($('mySelect'))", 1000);
> >   });
>
> > Using jQuerys getScript to bring in Prototype, the console.log with
> > the timeout set returns the same thing as the console.log inside of
> > the callback from the getScript.  In case you don't know jQuery:
>
> > $(function() {
>
> > });
>
> > is shorthand for executing this anonymous function once the page
> > loads.  The first
>
> >  console.log($('mySelect'));
>
> > shows an empty array, which it should because $ is similar to
> > Prototypes $$ and should have a # in front of it to get by id.
>
> > next, the
>
> > (function() {
>
> > })();
>
> > is meant to contain the loading of Prototype.
>
> > The console.log inside of the callback executes as expected, and logs
> > the element with an id of mySelect.  The console.log called just
> > outside of the containing anonymous function returns an empty array,
> > as expected, as prototype hasn't had time to load just yet but the
> > console.log inside of the timeout logs the element with the id of
> > mySelect, using prototype.  So, everything that runs after prototype
> > has loaded by the getScript will have access to Prototype.
>
> > I'm not sure if loading the text server side in the (function() {})();
> > will work either, possibly this doesn't work because Prototype changes
> > the prototype of objects declared outside of the (function(){})();
> > which bears further testing.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to