(Weak){Set|Map} subclassing

Erik Arvidsson erik.arvidsson at gmail.com
Tue Dec 4 06:40:14 PST 2012


On Mon, Dec 3, 2012 at 6:52 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

>
> OK, so it sounds like we have a plan. I'll update the spec. to use
> @@create.
>

Thanks for resolving this. Having the class side inheritance for @@create
makes complete sense to me and it solves a lot of issues. It can be used to
explain how subclassing Array and DOM objects work too.

For example:

HTMLButtonElement.@@create = function() {
  return document.createElement('button');
};

class MyButton extends HTMLButtonElement {
  constructor(text) {
    this.textContent = text;
  }
}

-- 
erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121204/19cbc02e/attachment-0001.html>


More information about the es-discuss mailing list