d3 attr修改源码支持object输入

mac2024-04-13  52

function selection_attr(name, value) { var fullname = namespace(name); if (arguments.length < 2) { // TODO: if (typeof(arguments[0]) === 'object') { for(var item in arguments[0]) { var key = namespace(item); var todo = arguments[0][item]; this.each((todo == null ? (key.local ? attrRemoveNS : attrRemove) : (typeof todo === "function" ? (key.local ? attrFunctionNS : attrFunction) : (key.local ? attrConstantNS : attrConstant)))(key, todo)); } return this // end TODO: } else { var node = this.node(); return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname); } } return this.each((value == null ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction) : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)); }
最新回复(0)