Last active
December 19, 2015 04:49
-
-
Save girlcheese/5899766 to your computer and use it in GitHub Desktop.
Utility function : Element Factory (Using require pattern) ... A bit perverse as its using require to populate a global utility object. But hey.
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
/*global define, window */ | |
define(['jquery'], function ($) { | |
'use strict'; | |
var GU = window.GU || {}; | |
GU.UTIL = GU.UTIL || {}; | |
/* Element factory. | |
* @param {string} el The name of a DOM element | |
* @return {jQuery} a DOM element as a jQuery object | |
*/ | |
GU.UTIL.el = function (el){ | |
return $(document.createElement(el)); | |
}; | |
return GU; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment