[whatwg] Specs for window.atob() and window.btoa()
Jorge
jorge at jorgechamorro.com
Fri Feb 4 15:54:27 PST 2011
On 04/02/2011, at 19:54, Aryeh Gregor wrote:
> On Fri, Feb 4, 2011 at 1:19 PM, Jorge <jorge at jorgechamorro.com> wrote:
>
>> unless the spec says *not* to throw but to skip over instead, so that in a few years the cleanup can be ~safely skipped.
>
> Nope. The spec isn't going to change browser behavior here if there
> are sites that depend on the current behavior -- and reportedly there
> are. There's just no incentive for browsers to change; the proposed
> behavior isn't sufficiently superior to warrant even slight
> compatibility pain. We can change web APIs in ways that might cause
> some compatibility pain if we have good reason, but for really minor
> things like this it's just not worth it. Browsers can only afford to
> break a certain number of websites per release before users start to
> get annoyed, and we shouldn't be wasting it on things like this.
>
> (IMO as a non-implementer, anyway. My opinion doesn't actually carry
> any weight here, though. I'm just guessing what implementers will
> say.)
How is this :
try {
var result= atob(input); // will throw if input has whitespace
}
catch (e) {
try {
var result= atob( input.replace(/\s/g, '') ); // will throw if input is not proper base64
}
catch (e) {
throw e;
}
}
any better than :
var result= atob(input); // will throw if input is not proper base64
?
[ It's not any better: it's awkward, slower, and requires more memory ]
And what's up with Postel's Law :-) ?
--
Jorge.
More information about the whatwg
mailing list