Last active
August 29, 2015 14:15
-
-
Save spite/3b8f3a095048122ef19f to your computer and use it in GitHub Desktop.
Makes creating canvas, audio, video and other HTML elements less verbose
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
( function() { | |
function sugarifyNew( id ) { | |
var name = id + ''; | |
var fnName = name.charAt( 0 ).toUpperCase() + name.substr( 1 ); | |
window[ fnName ] = function() { | |
return document.createElement( id ); | |
} | |
} | |
sugarifyNew( 'canvas' ); | |
sugarifyNew( 'video' ); | |
} )(); | |
var canvas = new Canvas(), | |
video = new Video(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Removed Audio because there's already a constructor for that. (duh)