User:Mike Dillon/Scripts/easydom.js: Difference between revisions

Content deleted Content added
m expand tag name list
move DOM element creation into a function
Line 4:
var stringType = typeof '';
var functionType = typeof function() {};
 
// Creates the DOM element
var createElement = function(name) {
var elem = document.createElement(name);
return elem;
};
 
// Detects if the first element is a hash of attributes and if so,
Line 53 ⟶ 59:
// Return the function that creates new DOM elements
return function() {
var elem = document.createElement(name);
 
// Process attribute hash, if any and skip the argument count returned