Created
April 14, 2013 01:34
-
-
Save csuwildcat/5380969 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/*** Option 1 - no ES6, all using defaults ***/ | |
<element tagname="x-foo"> | |
<script> | |
// By default, the tag name is used to generate the | |
// named constructor object - without rebinding 'this' | |
XFooElement.prototype.bar = ... | |
</script> | |
</element> | |
/*** Option 2 - no ES6, using optional attributes ***/ | |
<element tagname="x-foo" extends="SVGElement" constructor="SuperVG"> | |
<script> | |
// By choice, the developer can extend from an existing | |
// tag using extends="", and/or specify a non-default constructor | |
// name via constructor="" - again, without rebinding 'this' | |
SuperVG.prototype.bar = ... | |
</script> | |
</element> | |
/*** Option 3 - dev-optional use of ES6 ***/ | |
<element tagname="x-foo" constructor="SuperVG"> | |
<script> | |
// By choice, the developer can specify a non-default constructor | |
// name via constructor="", then extend that using ES6. | |
class SuperVG extends SVGElement {} | |
</script> | |
</element> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment