Re: Is polyfilling future web APIs a good idea?

Because it will "probably" become a real polyfill.
Em Thu, Aug 6, 2015 às 4:00 AM, Glen Huang <curvedmark@gmail.com> escreveu:

> Thanks for the detailed explanation.
>
> The only thing I'm not sure I understand is the pattern you described:
>
> ```
> HTMLElement.prototype.foo = HTMLElement.prototype._foo;
> ```
>
> I had this pattern in mind when you talked about prollyfills:
>
> ```
> HTMLElement.prototype._foo = function() {
>   if (HTMLElement.prototype.foo) return this.foo();
>   return polyfill();
> };
> ```
>
> And users are expected to use it like html._foo() My concern was that when
> most browsers ship HTMLElement.prototype.foo, users might want to change
> html._foo() to html.foo() so they can use the native version, and the
> prollyfill is expect to release a new version with
>
> ```
> if (!HTMLElement.prototype.foo) {
>   HTMLElement.prototype.foo = function() {
>     return polyfill();
>   };
> }
> ```
>
> I was saying changing html._foo() to html.foo() aren't that different from
> changing foo(html) to html.foo();
>
> Where does HTMLElement.prototype.foo = HTMLElement.prototype._foo fit in
> the picture?
>
> BTW, just curious, how do you come up with the name "prollyfill" :) ? Why
> adding a R there?
>
>
>
>
>

Received on Thursday, 6 August 2015 16:29:20 UTC