On Tue, Apr 12, 2011 at 5:35 PM, Jonas Sicking <[email protected]> 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