/* 创建svg对象 */
var SVG_NS = "http://www.w3.org/2000/svg";
var XLINK_NS = "http://www.w3.org/1999/xlink";
var ATTR_MAP = {
"className": "class",
"svgHref": "href"
};
var NS_MAP = {
"svgHref": XLINK_NS
};
function makeSVG(tag, attributes) {
var elem = document.createElementNS(SVG_NS, tag);
for (var attribute in attributes) {
var name = (attribute in ATTR_MAP ? ATTR_MAP[attribute] : attribute);
var value = attributes[attribute];
if (attribute in NS_MAP)
elem.setAttributeNS(NS_MAP[attribute], name, value);
else
elem.setAttribute(name, value);
}
return elem;
}