At 8:31 PM +0100 3/5/08, Christophe Porteneuve wrote:
>Steve Upton a écrit :
>> I'm trying to transition from Prototype 1.5.x to 1.6.x and now I have
>> code (a cross-site plug-in) that is complaining about the absence of
>> Request.setOptions(xxx)
>
>That's monkey-patching: Ajax.Request#setOptions was never a part of the
>public API, so the code you're mentioning was relying on an internal
>implementation detailŠ
Ah! understood. That would explain the lack of documentation...
> > When I search for setOptions in Proto 1.5 it's there but I can't find
>> it in Proto 1.6.x.
>
>Yes, it's been refactored when Tobie introduced Ajax.Response.
>
>> I'm OK with it changing into something else, the problem is that I
>> can't seem to find any documentation anywhere for the function OR its
>> replacement in 1.6
>
>It's embedded in the initialize function now (which doesn't do much
>else). I can't say overwriting that would be clean or safeŠ
OK.... every time I think I have my head around Javascript I find there are
many more was to be baffled...
If you could... Here is the code snippit. (this is part of a 'plug-in' that
streamlines cross-site scripting using the <script> method. I want to
communicate to another site (that we can control content coming from) and this
plug-in seems to do the job well... in Proto 1.5
anyway, here's the code
//------------------------------- Extend prototype a bit -----------------------
//
Ajax.Request.prototype = Object.extend(Ajax.Request.prototype,{
initialize: function(url, options) {
this.setOptions(options);
this.transport = (!this.options.crossSite) ? Ajax.getTransport() : new
scriptTransport;
this.options.asynchronous = (!this.options.crossSite) ?
this.options.asynchronous : false;
//turns off the timed onLoad executer
this.transport.respondToReadyState =
this.respondToReadyState.bind(this);
this.request(url);
}
});
//---------------------------------------------------------------------------------
Is there a straight-forward way of doing this under Proto 1.6? Or a least a
place I can go to learn more about making this work?
thanks for your help
regards,
Steve Upton
--
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---