Re: XHR responseArrayBuffer attribute: suggestion to replace "asBlob" with "responseType"

On 11/3/10 7:06 AM, Jonas Sicking wrote:
>> No, my concern is that browsers will implement this, and then sites that
>> haven't updated their jquery, and probably never plan to do it, will start
>> using the new stuff browsers have implemented.
>
> But won't that always fail? If the author either sets .responseType
> when jquery doesn't expect it, or the author uses .response when
> jquery hasn't set .responseType?

In the particular case of jquery, yes, unless there are some try/catch 
blocks around.

With other things, it might not be so simple.  Looking at 
http://prototypejs.org/assets/2009/8/31/prototype.js it seems they 
try/catch around their .responseText stuff and turn those exceptions it 
into events....

> Yes, it means that pages that use old code can't use the new features
> together with that code, but I don't see that as a big problem in this
> case.

My problem is that it seems, to me, to be really easy to get into 
situations where things _seem_ to work, but don't really, or don't with 
a slight change in totally unrelated code.  Since jquery always gets 
responseText that's not the case there in that you'd get an exception at 
that point.  But prototype is catching such exceptions, and again my 
concern is cases where different codepaths end up assuming different 
things from the same XHR in hard-to-debug ways.

I might be wrong, of course.  But I think we'd be creating a debugging 
nightmare for web page authors.

-Boris

Received on Wednesday, 3 November 2010 14:30:22 UTC