| 61 | var d3_parse_attributes_regex = /([\.#])/g; |
| 62 | |
| 63 | function d3_parse_attributes(name) { |
| 64 | if (typeof name === "string") { |
| 65 | var attr = {}, |
| 66 | parts = name.split(d3_parse_attributes_regex), p; |
| 67 | name = parts.shift(); |
| 68 | while ((p = parts.shift())) { |
| 69 | if (p == '.') attr['class'] = attr['class'] ? attr['class'] + ' ' + parts.shift() : parts.shift(); |
| 70 | else if (p == '#') attr.id = parts.shift(); |
| 71 | } |
| 72 | return attr.id || attr['class'] ? { tag: name, attr: attr } : name; |
| 73 | } |
| 74 | return name; |
| 75 | } |
| 76 | |
| 77 | function d3_selection_creator(name) { |
| 78 | return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() { |