Re: [FileAPI] File.slice spec bug

On Tue, Apr 12, 2011 at 3:22 PM, Glenn Maynard <glenn@zewt.org> wrote:
> On Tue, Apr 12, 2011 at 5:35 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> No, but feature testing only when you're about to use the function
>> shouldn't be a problem, no?
>
> I'd much rather be able to detect this once, in a self-contained,
> code-and-forget backwards-compatibility block, for example something like:
>
> (function() {
>     var bb = new BlobBuilder();
>     bb.append("abcd");
>     if(bb.getBlob().slice(2, 2).size == 2)
>     {
>         var origSlice = Blob.prototype.slice;
>         Blob.prototype.slice = function(start, end) { return
> origSlice.apply(this, [start, end - start]); }
>     }
> })();
>
> I could monkey patch slice to do this test each time, of course, but then
> instead of a nasty monkey patch only applied on old browsers, it'd be
> applied to every browser.

Well, given that I can get a fix into Firefox 4.0.1 then Firefox won't
be a problem.

So the question is if we can convinced the Chrome/Opera guys to take
this change. I think the best thing would otherwise be to remove
.slice() entirely and replace it with something else to remove
confusion.

/ Jonas

Received on Tuesday, 12 April 2011 23:57:41 UTC