Skip to content

Instantly share code, notes, and snippets.

@girlcheese
Last active December 19, 2015 04:49
Show Gist options
  • Save girlcheese/5899766 to your computer and use it in GitHub Desktop.
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.
/*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