Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for extending DOM classes #87

Open
arv opened this issue Mar 28, 2013 · 5 comments
Open

Add support for extending DOM classes #87

arv opened this issue Mar 28, 2013 · 5 comments

Comments

@arv
Copy link
Collaborator

arv commented Mar 28, 2013

Original author: arv@chromium.org (April 07, 2012 05:32:14)

With the change to max-min classes we lost the ability to extend DOM classes. We should add that hack again because it is really awesome.

Original issue: http://code.google.com/p/traceur-compiler/issues/detail?id=84

@arv
Copy link
Collaborator Author

arv commented Mar 28, 2013

From johnjbar...@chromium.org on May 08, 2012 19:23:24
Two tests fail, they are now skipped and will need be re-instated when this issue is fixed:

http://code.google.com/p/traceur-compiler/source/detail?r=671339c959178f3d12f584dbdb2a2375b80ab2cc

@dy
Copy link

dy commented Feb 9, 2014

+ for that.
What is the hack to get able to extend DOM classes? Is it a substitution of prototype, like so:

class CustomElement extends HTMLDivElement{
     constructor(){
        var self = document.createElement('div');
        self.__proto__ = this.__proto__;
        return self;
    }

    customMethod(){
        //`this` here is the div element
    }
}

?

@arv
Copy link
Collaborator Author

arv commented Feb 9, 2014

That is what we used to do.

The new way is based on Symbol.create and I have an old branch for that. It has some severe performance issues so I never finished that work. https://github.com/arv/traceur-compiler/tree/new-new-behavior

@arv
Copy link
Collaborator Author

arv commented Nov 2, 2014

Symbol.create has been removed from the spec but there is the [[CreateAction]] which is similar enough.

@OliverJAsh
Copy link
Contributor

For anyone else who comes here in search of extending Error, I believe this issue has relevance (according to @arv: https://groups.google.com/d/msg/traceur-compiler-discuss/4BqJcCuQNPQ/TPsh8SjQ2WMJ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants