Re: document.register and ES6

On Wed, Feb 6, 2013 at 4:27 PM, Daniel Buchner <daniel@mozilla.com> wrote:
> So you're directly setting the user-added methods on matched elements in
> browsers that don't support proto, but what about accessors?
>
> If we modified the spec (as previously suggested) to take an *unbaked*
> prototype object, we could polyfill all property types:

Just use the dedicated syntax. Using property descriptor is an anti
pattern. We must not expose new APIs that PDs.

>
> var myButton = document.register('x-mybutton', {
>     prototype: {
>         foo: {
>             set: function(){ ... },
>             get: function(){ ... }
>         }
>     }
> });

var myButton = document.register('x-mybutton', {
  prototype: {
    get foo() { ... },
    set foo(v) { ... }
  }
});


--
erik

Received on Wednesday, 6 February 2013 21:46:12 UTC