| 1958 | } |
| 1959 | |
| 1960 | function selection_join(onenter, onupdate, onexit) { |
| 1961 | var enter = this.enter(), update = this, exit = this.exit(); |
| 1962 | if (typeof onenter === "function") { |
| 1963 | enter = onenter(enter); |
| 1964 | if (enter) enter = enter.selection(); |
| 1965 | } else { |
| 1966 | enter = enter.append(onenter + ""); |
| 1967 | } |
| 1968 | if (onupdate != null) { |
| 1969 | update = onupdate(update); |
| 1970 | if (update) update = update.selection(); |
| 1971 | } |
| 1972 | if (onexit == null) exit.remove(); else onexit(exit); |
| 1973 | return enter && update ? enter.merge(update).order() : update; |
| 1974 | } |
| 1975 | |
| 1976 | function selection_merge(context) { |
| 1977 | var selection = context.selection ? context.selection() : context; |