/** * DOM utilities */ (function(window, TF){ 'use strict'; TF.Dom = {}; /** * Returns text + text of children of given node * @param {NodeElement} node * @return {String} */ TF.Dom.getText = function(node){ var s = node.textContent || node.innerText || node.innerHTML.replace(/<[^<>]+>/g, ''); s = s.replace(/^\s+/, '').replace(/\s+$/, ''); return s/*.tf_Trim()*/; }; /** * Creates an html element with given collection of attributes * @param {String} tag a string of the html tag to create * @param {Array} an undetermined number of arrays containing the with 2 * items, the attribute name and its value ['id','myId'] * @return {Object} created element */ TF.Dom.create = function(tag){ if(!tag || tag===''){ return; } var el = document.createElement(tag), args = arguments; if(args.length > 1){ for(var i=0; i