创建Element对象create
api的应用场景是:创建一个Element对象
?
关于ZYC.dom.g的资料:http://zhangyaochun.iteye.com/blog/1439262
?
关于ZYC.dom.setAttr的资料:http://zhangyaochun.iteye.com/blog/1461224
?
?
/**setAttrs-set the attribute value for the element with the key**@function**@param {string||HTMLElement} element**@param {Object} attributes just like collection --{size:sizeValue,disabled:"disabled"}**relay on ZYC.dom.setAttr**@return {HTMLElement}**/ZYC.dom.setAttrs = function(element,attributes){ element = ZYC.dom.g(element);for(var key in attributes){ ZYC.dom.setAttr(element,key,attributes[key]);} return element;};?
?
?
?
?
/**create-create an element**@function**@param {string} tagName**@param {object} ops_attrs**relay on ZYC.dom.setAttrs**@return {HTMLElement}**/ZYC.dom.create = function(tagName,ops_attrs){ var el = document.createElement(tagName); return ZYC.dom.setAttrs(el,ops_attrs);};