W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: [FileAPI] File.slice spec bug

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 12 Apr 2011 18:22:57 -0400
Message-ID: <BANLkTikoyC-PunLivACvs7ugx3K1hDkBKQ@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: Webapps WG <public-webapps@w3.org>
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.

-- 
Glenn Maynard
Received on Wednesday, 13 April 2011 00:02:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:44 GMT