Created
October 11, 2017 23:40
-
-
Save AdaRoseCannon/ecc847d8bba5eb9f522fc9bec6963817 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTMLElementWithRefs extends HTMLElement { | |
constructor () { | |
super(); | |
this.refs = new Proxy({}, { | |
get: this.__getFromShadowRoot.bind(this) | |
}); | |
} | |
__getFromShadowRoot (target, name) { | |
return this.shadowRoot.querySelector('[ref="' + name + '"]'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment