I am working on a content delivery solution. This would allow people
to include some content on their page by adding a script tag. I would
like to add some slickness to the content, so I would like to use
Prototype.
I'm looking for some suggestions to safely add Prototype to the target
pages (I'm inserting a script tag dynamically) without interfering
with an existing copy of Prototype, jQuery or other libraries.
----- Original Message ----- From: "Diodeus" <diod...@gmail.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Thursday, July 09, 2009 8:10 PM
Subject: [Proto-Scripty] Alternatives to Protosafe?
> I am working on a content delivery solution. This would allow people
> to include some content on their page by adding a script tag. I would
> like to add some slickness to the content, so I would like to use
> Prototype.
> I'm looking for some suggestions to safely add Prototype to the target
> pages (I'm inserting a script tag dynamically) without interfering
> with an existing copy of Prototype, jQuery or other libraries.
> You could check for the jQuery object - this will get round jQuery...
> if(jQuery) {
> ..........................
> }
> There must be prototype only objects/functions/classes you can test for in
> prototype....
> I am not sure about other libraries but i think extjs uses the "Ext."
> namespace and similar with yahoo
> ----- Original Message -----
> From: "Diodeus" <diod...@gmail.com>
> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
> Sent: Thursday, July 09, 2009 8:10 PM
> Subject: [Proto-Scripty] Alternatives to Protosafe?
> > I am working on a content delivery solution. This would allow people
> > to include some content on their page by adding a script tag. I would
> > like to add some slickness to the content, so I would like to use
> > Prototype.
> > I'm looking for some suggestions to safely add Prototype to the target
> > pages (I'm inserting a script tag dynamically) without interfering
> > with an existing copy of Prototype, jQuery or other libraries.
} -----Original Message----- Date: Thursday, July 09, 2009 4:48:45 pm To: <prototype-scriptaculous@googlegroups.com> From: "Alex McAuley" <webmas...@thecarmarketplace.com> Subject: [Proto-Scripty] Re: Alternatives to Protosafe?
You could check for the jQuery object - this will get round jQuery...
if(jQuery) { ..........................
} There must be prototype only objects/functions/classes you can test for in prototype....
I am not sure about other libraries but i think extjs uses the "Ext." namespace and similar with yahoo ----- Original Message ----- From: "Diodeus" <diod...@gmail.com> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com> Sent: Thursday, July 09, 2009 8:10 PM Subject: [Proto-Scripty] Alternatives to Protosafe?
> I am working on a content delivery solution. This would allow people > to include some content on their page by adding a script tag. I would > like to add some slickness to the content, so I would like to use > Prototype.
> I'm looking for some suggestions to safely add Prototype to the target > pages (I'm inserting a script tag dynamically) without interfering > with an existing copy of Prototype, jQuery or other libraries.
----- Original Message ----- From: <waldron.r...@gmail.com>
To: <prototype-scriptaculous@googlegroups.com>
Sent: Thursday, July 09, 2009 9:58 PM
Subject: [Proto-Scripty] Re: Alternatives to Protosafe?
> Alex, he can just check for Prototype :)
> if ( Prototype ) {
> .....
> }
> -----Original Message-----
> Date: Thursday, July 09, 2009 4:48:45 pm
> To: <prototype-scriptaculous@googlegroups.com>
> From: "Alex McAuley" <webmas...@thecarmarketplace.com>
> Subject: [Proto-Scripty] Re: Alternatives to Protosafe?
> You could check for the jQuery object - this will get round jQuery...
> if(jQuery) {
> ..........................
> }
> There must be prototype only objects/functions/classes you can test for in
> prototype....
> I am not sure about other libraries but i think extjs uses the "Ext."
> namespace and similar with yahoo
> ----- Original Message ----- > From: "Diodeus" <diod...@gmail.com>
> To: "Prototype & script.aculo.us" > <prototype-scriptaculous@googlegroups.com>
> Sent: Thursday, July 09, 2009 8:10 PM
> Subject: [Proto-Scripty] Alternatives to Protosafe?
>> I am working on a content delivery solution. This would allow people
>> to include some content on their page by adding a script tag. I would
>> like to add some slickness to the content, so I would like to use
>> Prototype.
>> I'm looking for some suggestions to safely add Prototype to the target
>> pages (I'm inserting a script tag dynamically) without interfering
>> with an existing copy of Prototype, jQuery or other libraries.
----- Original Message ----- From: "Diodeus" <diod...@gmail.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Thursday, July 09, 2009 9:52 PM
Subject: [Proto-Scripty] Re: Alternatives to Protosafe?
I'd rather not test for conflicts, but rather to safely coexist.
On Jul 9, 4:48 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> You could check for the jQuery object - this will get round jQuery...
> if(jQuery) {
> ..........................
> }
> There must be prototype only objects/functions/classes you can test for in
> prototype....
> I am not sure about other libraries but i think extjs uses the "Ext."
> namespace and similar with yahoo
> ----- Original Message -----
> From: "Diodeus" <diod...@gmail.com>
> To: "Prototype & script.aculo.us" > <prototype-scriptaculous@googlegroups.com>
> Sent: Thursday, July 09, 2009 8:10 PM
> Subject: [Proto-Scripty] Alternatives to Protosafe?
> > I am working on a content delivery solution. This would allow people
> > to include some content on their page by adding a script tag. I would
> > like to add some slickness to the content, so I would like to use
> > Prototype.
> > I'm looking for some suggestions to safely add Prototype to the target
> > pages (I'm inserting a script tag dynamically) without interfering
> > with an existing copy of Prototype, jQuery or other libraries.
> well anything that uses "$" will not safley co-exist so you -need- to test
> for conflicts in order to co-exist properly
> ----- Original Message -----
> From: "Diodeus" <diod...@gmail.com>
> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
> Sent: Thursday, July 09, 2009 9:52 PM
> Subject: [Proto-Scripty] Re: Alternatives to Protosafe?
> I'd rather not test for conflicts, but rather to safely coexist.
> On Jul 9, 4:48 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
> wrote:
> > You could check for the jQuery object - this will get round jQuery...
> > if(jQuery) {
> > ..........................
> > }
> > There must be prototype only objects/functions/classes you can test for in
> > prototype....
> > I am not sure about other libraries but i think extjs uses the "Ext."
> > namespace and similar with yahoo
> > ----- Original Message -----
> > From: "Diodeus" <diod...@gmail.com>
> > To: "Prototype & script.aculo.us"
> > <prototype-scriptaculous@googlegroups.com>
> > Sent: Thursday, July 09, 2009 8:10 PM
> > Subject: [Proto-Scripty] Alternatives to Protosafe?
> > > I am working on a content delivery solution. This would allow people
> > > to include some content on their page by adding a script tag. I would
> > > like to add some slickness to the content, so I would like to use
> > > Prototype.
> > > I'm looking for some suggestions to safely add Prototype to the target
> > > pages (I'm inserting a script tag dynamically) without interfering
> > > with an existing copy of Prototype, jQuery or other libraries.
You cannot safely add Prototype to the target pages. Prototype
changes javascript in general, not just jQuery. It adds methods to
native objects. If the target pages are already running jQuery in
noConflict() mode then you won't interfere, but if you put their pages
in noConflict() mode then you will mess up their javascript that
relies on it. There could also be custom code that relies on for
(each in obj) that will break if you add prototype, and there is no
way to check for that.
You will also be breaking pages that use mootools, which does not have
a noConflict() mode.
Prototype does not have a noConflict() mode because the theory behind
it prevents that from happening, once native objects are extended
there is no way to unextend them. You are going to have to use jQuery
or Dojo for this project if you want to add a library to their pages.
Probably jQuery as it only adds the jQuery variable to the global
namespace, and even then you should use noConflict() mode and return
the $ to its previous state before exiting your code, so in case they
are using jQuery you give them back use of $ before you are done.
If you want to do the least potential damage by adding Prototype to
others pages, then check to make sure it doesn't already exist, and
then check to make sure $ doesn't already exist, and if it does
disable any special effects or give a warning saying that this feature
cannot be used because it will interfere with the existing code.
Good luck!
On Jul 9, 12:10 pm, Diodeus <diod...@gmail.com> wrote:
> I am working on a content delivery solution. This would allow people
> to include some content on their page by adding a script tag. I would
> like to add some slickness to the content, so I would like to use
> Prototype.
> I'm looking for some suggestions to safely add Prototype to the target
> pages (I'm inserting a script tag dynamically) without interfering
> with an existing copy of Prototype, jQuery or other libraries.
> You cannot safely add Prototype to the target pages. Prototype
> changes javascript in general, not just jQuery. It adds methods to
> native objects. If the target pages are already running jQuery in
> noConflict() mode then you won't interfere, but if you put their pages
> in noConflict() mode then you will mess up their javascript that
> relies on it. There could also be custom code that relies on for
> (each in obj) that will break if you add prototype, and there is no
> way to check for that.
> You will also be breaking pages that use mootools, which does not have
> a noConflict() mode.
> Prototype does not have a noConflict() mode because the theory behind
> it prevents that from happening, once native objects are extended
> there is no way to unextend them. You are going to have to use jQuery
> or Dojo for this project if you want to add a library to their pages.
> Probably jQuery as it only adds the jQuery variable to the global
> namespace, and even then you should use noConflict() mode and return
> the $ to its previous state before exiting your code, so in case they
> are using jQuery you give them back use of $ before you are done.
> If you want to do the least potential damage by adding Prototype to
> others pages, then check to make sure it doesn't already exist, and
> then check to make sure $ doesn't already exist, and if it does
> disable any special effects or give a warning saying that this feature
> cannot be used because it will interfere with the existing code.
> Good luck!
> On Jul 9, 12:10 pm, Diodeus <diod...@gmail.com> wrote:
> > I am working on a content delivery solution. This would allow people
> > to include some content on their page by adding a script tag. I would
> > like to add some slickness to the content, so I would like to use
> > Prototype.
> > I'm looking for some suggestions to safely add Prototype to the target
> > pages (I'm inserting a script tag dynamically) without interfering
> > with an existing copy of Prototype, jQuery or other libraries.
If other libraries or js code extend the native objects with the same
methods, the one included last wins. In this case, it will almost
always be prototype because he is loading it dynamically.
On Jul 10, 1:04 pm, Matt Foster <mattfoste...@gmail.com> wrote:
> Besides the $ function and using for(var in ) for iteration over an
> array. I can't think of other conflicts prototype would cause with
> existing code.
> On Jul 10, 2:41 pm, Josh Powell <seas...@gmail.com> wrote:
> > You cannot safely add Prototype to the target pages. Prototype
> > changes javascript in general, not just jQuery. It adds methods to
> > native objects. If the target pages are already running jQuery in
> > noConflict() mode then you won't interfere, but if you put their pages
> > in noConflict() mode then you will mess up their javascript that
> > relies on it. There could also be custom code that relies on for
> > (each in obj) that will break if you add prototype, and there is no
> > way to check for that.
> > You will also be breaking pages that use mootools, which does not have
> > a noConflict() mode.
> > Prototype does not have a noConflict() mode because the theory behind
> > it prevents that from happening, once native objects are extended
> > there is no way to unextend them. You are going to have to use jQuery
> > or Dojo for this project if you want to add a library to their pages.
> > Probably jQuery as it only adds the jQuery variable to the global
> > namespace, and even then you should use noConflict() mode and return
> > the $ to its previous state before exiting your code, so in case they
> > are using jQuery you give them back use of $ before you are done.
> > If you want to do the least potential damage by adding Prototype to
> > others pages, then check to make sure it doesn't already exist, and
> > then check to make sure $ doesn't already exist, and if it does
> > disable any special effects or give a warning saying that this feature
> > cannot be used because it will interfere with the existing code.
> > Good luck!
> > On Jul 9, 12:10 pm, Diodeus <diod...@gmail.com> wrote:
> > > I am working on a content delivery solution. This would allow people
> > > to include some content on their page by adding a script tag. I would
> > > like to add some slickness to the content, so I would like to use
> > > Prototype.
> > > I'm looking for some suggestions to safely add Prototype to the target
> > > pages (I'm inserting a script tag dynamically) without interfering
> > > with an existing copy of Prototype, jQuery or other libraries.