d3-selection
Advanced tools
Comparing version 0.1.0 to 0.2.0
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.d3 = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function (global){ | ||
var Selection = require("./selection"); // TODO remove dependency | ||
// https://bugs.webkit.org/show_bug.cgi?id=44083 | ||
var bug44083 = global.navigator && /WebKit/.test(global.navigator.userAgent) ? -1 : 0; | ||
function point(node, event) { | ||
var svg = node.ownerSVGElement || node; | ||
if (svg.createSVGPoint) { | ||
var point = svg.createSVGPoint(); | ||
if (bug44083 < 0) { | ||
var window = global.window; // Must exist if bug44083. | ||
if (window.scrollX || window.scrollY) { | ||
svg = Selection.select("body").append("svg").style({position: "absolute", top: 0, left: 0, margin: 0, padding: 0, border: "none"}, "important"); | ||
var ctm = svg.node().getScreenCTM(); | ||
bug44083 = !(ctm.f || ctm.e); | ||
svg.remove(); | ||
} | ||
} | ||
if (bug44083) point.x = event.pageX, point.y = event.pageY; | ||
else point.x = event.clientX, point.y = event.clientY; | ||
point = point.matrixTransform(node.getScreenCTM().inverse()); | ||
return [point.x, point.y]; | ||
} | ||
var rect = node.getBoundingClientRect(); | ||
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop]; | ||
} | ||
function source() { | ||
var event = global.d3.event, source; | ||
while (source = event.sourceEvent) event = source; | ||
return event; | ||
} | ||
exports.mouse = function(node, event) { | ||
if (arguments.length < 2) event = source(); | ||
if (event.changedTouches) event = event.changedTouches[0]; | ||
return point(node, event); | ||
}; | ||
exports.touch = function(node, touches, identifier) { | ||
if (arguments.length < 3) identifier = touches, touches = source().changedTouches; | ||
for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) { | ||
if ((touch = touches[i]).identifier === identifier) { | ||
return point(node, touch); | ||
} | ||
} | ||
return null; | ||
}; | ||
exports.touches = function(node, touches) { | ||
if (arguments.length < 2) touches = source().touches; | ||
for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) { | ||
points[i] = point(node, touches[i]); | ||
} | ||
return points; | ||
}; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./selection":3}],2:[function(require,module,exports){ | ||
var prefixes = exports.prefix = { | ||
svg: "http://www.w3.org/2000/svg", | ||
xhtml: "http://www.w3.org/1999/xhtml", | ||
xlink: "http://www.w3.org/1999/xlink", | ||
xml: "http://www.w3.org/XML/1998/namespace", | ||
xmlns: "http://www.w3.org/2000/xmlns/" | ||
}; | ||
exports.qualify = function(name) { | ||
var i = name.indexOf(":"), | ||
prefix = name; | ||
if (i >= 0) { | ||
prefix = name.slice(0, i); | ||
name = name.slice(i + 1); | ||
} | ||
return prefixes.hasOwnProperty(prefix) | ||
? {space: prefixes[prefix], local: name} | ||
: name; | ||
}; | ||
},{}],3:[function(require,module,exports){ | ||
(function (global){ | ||
var namespace = require("./namespace"); | ||
var Map = global.Map, | ||
document = global.document, | ||
CustomEvent = global.CustomEvent, | ||
var d3 = module.exports = global.d3 || (global.d3 = {}), | ||
Map = global.Map || (Map = function() {}, Map.prototype = {set: function(k, v) { this["$" + k] = v; return this; }, get: function(k) { return this["$" + k]; }, has: function(k) { return "$" + k in this; }}, Map), | ||
valueOf = function(value) { return function() { return value; }; }, | ||
@@ -95,41 +9,35 @@ selectorOf = function(selector) { return function() { return this.querySelector(selector); }; }, | ||
filterOf = function(selector) { return function() { return this.matches(selector); }; }, | ||
filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"}, | ||
requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; | ||
filterEvents = new Map, | ||
noop = function() {}, | ||
ascending = function(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; }, | ||
collapse = function(string) { return string.trim().replace(/\s+/g, " "); }, | ||
requote = function(string) { return string.replace(requoteRe, "\\$&"); }, | ||
requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g, | ||
bug44083 = global.navigator && /WebKit/.test(global.navigator.userAgent) ? -1 : 0; // https://bugs.webkit.org/show_bug.cgi?id=44083 | ||
if (document) { | ||
var node = document.documentElement; | ||
if (!node.matches) { | ||
var vendorMatches = node.webkitMatchesSelector || node.msMatchesSelector || node.mozMatchesSelector || node.oMatchesSelector; | ||
(function(document) { | ||
if (!document) return; | ||
var element = document.documentElement; | ||
if (!("onmouseenter" in element)) { | ||
filterEvents.set("mouseenter", "mouseover").set("mouseleave", "mouseout"); | ||
} | ||
if (!element.matches) { | ||
var vendorMatches = element.webkitMatchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector; | ||
filterOf = function(selector) { return function() { return vendorMatches.call(this, selector); }; }; | ||
} | ||
})(global.document); | ||
for (var type in filterEvents) { | ||
if ("on" + type in document) { | ||
delete filterEvents[type]; | ||
} | ||
} | ||
d3.namespaces = (new Map) | ||
.set("svg", "http://www.w3.org/2000/svg") | ||
.set("xhtml", "http://www.w3.org/1999/xhtml") | ||
.set("xlink", "http://www.w3.org/1999/xlink") | ||
.set("xml", "http://www.w3.org/XML/1998/namespace") | ||
.set("xmlns", "http://www.w3.org/2000/xmlns/"); | ||
if (!CustomEvent) { | ||
CustomEvent = function(type, params) { | ||
var event = document.createEvent("CustomEvent"); | ||
if (params) event.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); | ||
else event.initCustomEvent(type, false, false, undefined); | ||
return event; | ||
}; | ||
CustomEvent.prototype = global.Event.prototype; | ||
} | ||
d3.namespace = function(name) { | ||
var i = name.indexOf(":"), prefix = name; | ||
if (i >= 0) prefix = name.slice(0, i), name = name.slice(i + 1); | ||
return d3.namespaces.has(prefix) ? {space: d3.namespaces.get(prefix), local: name} : name; | ||
}; | ||
node = type = null; | ||
} | ||
if (!Map) { | ||
Map = function() {}; | ||
Map.prototype = { | ||
set: function(key, value) { this["$" + key] = value; return this; }, | ||
get: function(key) { return this["$" + key]; }, | ||
has: function(key) { return "$" + key in this; } | ||
}; | ||
} | ||
// When depth = 1, root = [Node, …]. | ||
@@ -140,9 +48,9 @@ // When depth = 2, root = [[Node, …], …]. | ||
function Selection(root, depth) { | ||
root._parent = null; | ||
this._root = root; | ||
this._depth = depth; | ||
this._enter = null; | ||
this._exit = null; | ||
this._enter = this._update = this._exit = null; | ||
} | ||
d3.selection = Selection; | ||
Selection.prototype = { | ||
@@ -158,6 +66,5 @@ | ||
function visit(nodes, depth) { | ||
function visit(nodes, update, depth) { | ||
var i = -1, | ||
n = nodes.length, | ||
update, | ||
node, | ||
@@ -173,3 +80,3 @@ subnode, | ||
stack[stack0] = node._parent.__data__, stack[stack1] = i; | ||
subnodes[i] = visit(node, depth); | ||
subnodes[i] = visit(node, update && update[i], depth); | ||
} | ||
@@ -181,6 +88,5 @@ } | ||
// this preserves the index of nodes (unlike selection.filter). | ||
// Data is propagated to the new node only if it is defined on the old. | ||
// Propagate data to the new node only if it is defined on the old. | ||
// If this is an enter selection, materialized nodes are moved to update. | ||
else { | ||
update = nodes._update; | ||
while (++i < n) { | ||
@@ -202,3 +108,3 @@ if (node = nodes[i]) { | ||
return new Selection(visit(this._root, depth), depth); | ||
return new Selection(visit(this._root, this._update && this._update._root, depth), depth); | ||
}, | ||
@@ -314,8 +220,6 @@ | ||
this.enter(); // initializes _enter and _update references | ||
this.exit(); // initializes _exit references | ||
if (typeof value !== "function") value = valueOf(value); | ||
visit(this._root, depth); | ||
visit(this._root, this.enter()._root, this.exit()._root, depth); | ||
function visit(nodes, depth) { | ||
function visit(update, enter, exit, depth) { | ||
var i = -1, | ||
@@ -329,8 +233,8 @@ n, | ||
n = nodes.length; | ||
n = update.length; | ||
while (++i < n) { | ||
if (node = nodes[i]) { | ||
if (node = update[i]) { | ||
stack[stack0] = node._parent.__data__, stack[stack1] = i; | ||
visit(node, depth); | ||
visit(node, enter[i], exit[i], depth); | ||
} | ||
@@ -342,7 +246,6 @@ } | ||
var j = 0, | ||
enter = nodes._enter, | ||
before; | ||
bind(nodes, value.apply(nodes._parent, stack)); | ||
n = nodes.length; | ||
bind(update, enter, exit, value.apply(update._parent, stack)); | ||
n = update.length; | ||
@@ -355,3 +258,3 @@ // Now connect the enter nodes to their following update node, such that | ||
if (i >= j) j = i + 1; | ||
while (!(node = nodes[j]) && ++j < n); | ||
while (!(node = update[j]) && ++j < n); | ||
before._next = node || null; | ||
@@ -363,7 +266,5 @@ } | ||
function bindIndex(update, data) { | ||
function bindIndex(update, enter, exit, data) { | ||
var i = 0, | ||
node, | ||
enter = update._enter, | ||
exit = update._exit, | ||
nodeLength = update.length, | ||
@@ -402,7 +303,5 @@ dataLength = data.length, | ||
function bindKey(update, data) { | ||
function bindKey(update, enter, exit, data) { | ||
var i, | ||
node, | ||
enter = update._enter, | ||
exit = update._exit, | ||
dataLength = data.length, | ||
@@ -428,3 +327,2 @@ nodeLength = update.length, | ||
if (nodeByKeyValue.has(keyValue)) { | ||
delete update[i]; | ||
exit[i] = node; | ||
@@ -481,2 +379,3 @@ } | ||
enter: function() { | ||
if (this._enter) return this._enter; | ||
@@ -497,7 +396,2 @@ function visit(nodes, depth) { | ||
else { | ||
nodes._enter = enter; | ||
enter._update = nodes; | ||
} | ||
enter._parent = nodes._parent; | ||
@@ -507,3 +401,5 @@ return enter; | ||
return this._enter || (this._enter = new Selection(visit(arrayify(this), this._depth), this._depth)); | ||
this._enter = new Selection(visit(arrayify(this), this._depth), this._depth); | ||
this._enter._update = this; | ||
return this._enter; | ||
}, | ||
@@ -529,6 +425,2 @@ | ||
else { | ||
nodes._exit = exit; | ||
} | ||
exit._parent = nodes._parent; | ||
@@ -685,3 +577,3 @@ return exit; | ||
attr: function(name, value) { | ||
name = namespace.qualify(name); | ||
name = d3.namespace(name); | ||
@@ -751,7 +643,3 @@ if (arguments.length < 2) { | ||
return this.each(value == null | ||
? remove | ||
: (typeof value === "function" | ||
? setFunction | ||
: setConstant)); | ||
return this.each(value == null ? remove : typeof value === "function" ? setFunction : setConstant); | ||
}, | ||
@@ -776,7 +664,3 @@ | ||
return this.each(value == null | ||
? remove | ||
: (typeof value === "function" | ||
? setFunction | ||
: setConstant)); | ||
return this.each(value == null ? remove : typeof value === "function" ? setFunction : setConstant); | ||
}, | ||
@@ -885,3 +769,3 @@ | ||
if ((n = type.indexOf(".")) > 0) type = type.slice(0, n); | ||
if (filter = filterEvents.hasOwnProperty(type)) type = filterEvents[type]; | ||
if (filter = filterEvents.has(type)) type = filterEvents.get(type); | ||
@@ -925,7 +809,7 @@ function add() { | ||
function dispatchConstant() { | ||
return this.dispatchEvent(new CustomEvent(type, params)); | ||
return dispatchEvent(this, type, params); | ||
} | ||
function dispatchFunction() { | ||
return this.dispatchEvent(new CustomEvent(type, params.apply(this, arguments))); | ||
return dispatchEvent(this, type, params.apply(this, arguments)); | ||
} | ||
@@ -937,8 +821,31 @@ | ||
Selection.select = function(selector) { | ||
return new Selection([typeof selector === "string" ? document.querySelector(selector) : selector], 1); | ||
// Deprecated aliases for backwards-compatibility with 3.x: | ||
Selection.prototype.on = Selection.prototype.event; | ||
Selection.prototype.insert = Selection.prototype.append; | ||
Selection.prototype.classed = Selection.prototype.class; | ||
d3.select = function(selector) { | ||
var root; | ||
if (typeof selector === "string") { | ||
var document = global.document; | ||
root = [document.querySelector(selector)]; | ||
root._parent = document.documentElement; | ||
} else { | ||
root = [selector]; | ||
root._parent = null; | ||
} | ||
return new Selection(root, 1); | ||
}; | ||
Selection.selectAll = function(selector) { | ||
return new Selection(typeof selector === "string" ? document.querySelectorAll(selector) : selector, 1); | ||
d3.selectAll = function(selector) { | ||
var root; | ||
if (typeof selector === "string") { | ||
var document = global.document; | ||
root = document.querySelectorAll(selector); | ||
root._parent = document.documentElement; | ||
} else { | ||
root = selector; | ||
root._parent = null; | ||
} | ||
return new Selection(root, 1); | ||
}; | ||
@@ -959,4 +866,2 @@ | ||
function noop() {} | ||
// The leaf groups of the selection hierarchy are initially NodeList, | ||
@@ -993,3 +898,3 @@ // and then lazily converted to arrays when mutation is required. | ||
function creatorOf(name) { | ||
name = namespace.qualify(name); | ||
name = d3.namespace(name); | ||
@@ -1018,2 +923,17 @@ function creator() { | ||
function dispatchEvent(node, type, params) { | ||
var window = windowOf(node), | ||
event = window.CustomEvent; | ||
if (event) { | ||
event = new event(type, params); | ||
} else { | ||
event = window.document.createEvent("Event"); | ||
if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; | ||
else event.initEvent(type, false, false); | ||
} | ||
node.dispatchEvent(event); | ||
} | ||
function classerOf(name) { | ||
@@ -1036,9 +956,9 @@ var re; | ||
return function(event) { | ||
var i = ancestors.length, event0 = global.d3.event; // Events can be reentrant (e.g., focus). | ||
var i = ancestors.length, event0 = d3.event; // Events can be reentrant (e.g., focus). | ||
while (--i >= 0) args[i << 1] = ancestors[i].__data__; | ||
global.d3.event = event; | ||
d3.event = event; | ||
try { | ||
listener.apply(ancestors[0], args); | ||
} finally { | ||
global.d3.event = event0; | ||
d3.event = event0; | ||
} | ||
@@ -1057,40 +977,56 @@ }; | ||
function ascending(a, b) { | ||
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; | ||
function point(node, event) { | ||
var svg = node.ownerSVGElement || node; | ||
if (svg.createSVGPoint) { | ||
var point = svg.createSVGPoint(); | ||
if (bug44083 < 0) { | ||
var window = windowOf(node); | ||
if (window.scrollX || window.scrollY) { | ||
svg = d3.select(window.document.body).append("svg").style({position: "absolute", top: 0, left: 0, margin: 0, padding: 0, border: "none"}, "important"); | ||
var ctm = svg.node().getScreenCTM(); | ||
bug44083 = !(ctm.f || ctm.e); | ||
svg.remove(); | ||
} | ||
} | ||
if (bug44083) point.x = event.pageX, point.y = event.pageY; | ||
else point.x = event.clientX, point.y = event.clientY; | ||
point = point.matrixTransform(node.getScreenCTM().inverse()); | ||
return [point.x, point.y]; | ||
} | ||
var rect = node.getBoundingClientRect(); | ||
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop]; | ||
} | ||
function collapse(string) { | ||
return string.trim().replace(/\s+/g, " "); | ||
function source() { | ||
var event = d3.event, source; | ||
while (source = event.sourceEvent) event = source; | ||
return event; | ||
} | ||
function requote(string) { | ||
return string.replace(requoteRe, "\\$&"); | ||
} | ||
d3.mouse = function(node, event) { | ||
if (arguments.length < 2) event = source(); | ||
if (event.changedTouches) event = event.changedTouches[0]; | ||
return point(node, event); | ||
}; | ||
module.exports = Selection; | ||
d3.touch = function(node, touches, identifier) { | ||
if (arguments.length < 3) identifier = touches, touches = source().changedTouches; | ||
for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) { | ||
if ((touch = touches[i]).identifier === identifier) { | ||
return point(node, touch); | ||
} | ||
} | ||
return null; | ||
}; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./namespace":2}],4:[function(require,module,exports){ | ||
(function (global){ | ||
var event = require("./lib/d3/event"), | ||
namespace = require("./lib/d3/namespace"), | ||
selection = require("./lib/d3/selection"), | ||
d3 = module.exports = global.d3 || (global.d3 = {}); | ||
d3.touches = function(node, touches) { | ||
if (arguments.length < 2) touches = source().touches; | ||
for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) { | ||
points[i] = point(node, touches[i]); | ||
} | ||
return points; | ||
}; | ||
d3.mouse = event.mouse; | ||
d3.touch = event.touch; | ||
d3.touches = event.touches; | ||
d3.namespace = namespace.prefix; | ||
d3.selection = selection; | ||
d3.select = selection.select; | ||
d3.selectAll = selection.selectAll; | ||
// Deprecated aliases for backwards-compatibility with 3.x: | ||
d3.ns = namespace; | ||
selection.prototype.on = selection.prototype.event; | ||
selection.prototype.insert = selection.prototype.append; | ||
selection.prototype.classed = selection.prototype.class; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./lib/d3/event":1,"./lib/d3/namespace":2,"./lib/d3/selection":3}]},{},[4])(4) | ||
},{}]},{},[1])(1) | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.d3=t()}}(function(){return function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var n=e[a][1][t];return i(n?n:t)},f,f.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){(function(e){function r(t,n){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>a){var u=e.window;if(u.scrollX||u.scrollY){r=o.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var s=r.node().getScreenCTM();a=!(s.f||s.e),r.remove()}}return a?(i.x=n.pageX,i.y=n.pageY):(i.x=n.clientX,i.y=n.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var l=t.getBoundingClientRect();return[n.clientX-l.left-t.clientLeft,n.clientY-l.top-t.clientTop]}function i(){for(var t,n=e.d3.event;t=n.sourceEvent;)n=t;return n}var o=t("./selection"),a=e.navigator&&/WebKit/.test(e.navigator.userAgent)?-1:0;n.mouse=function(t,e){return arguments.length<2&&(e=i()),e.changedTouches&&(e=e.changedTouches[0]),r(t,e)},n.touch=function(t,e,n){arguments.length<3&&(n=e,e=i().changedTouches);for(var o,a=0,u=e?e.length:0;u>a;++a)if((o=e[a]).identifier===n)return r(t,o);return null},n.touches=function(t,e){arguments.length<2&&(e=i().touches);for(var n=0,o=e?e.length:0,a=new Array(o);o>n;++n)a[n]=r(t,e[n]);return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./selection":3}],2:[function(t,e,n){var r=n.prefix={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};n.qualify=function(t){var e=t.indexOf(":"),n=t;return e>=0&&(n=t.slice(0,e),t=t.slice(e+1)),r.hasOwnProperty(n)?{space:r[n],local:t}:t}},{}],3:[function(t,e,n){(function(n){function r(t,e){t._parent=null,this._root=t,this._depth=e,this._enter=null,this._exit=null}function i(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function o(){}function a(t){function e(t,n){var r,i=-1,o=t.length;if(--n)for(;++i<o;)(r=t[i])&&(t[i]=e(r,n));else if(!Array.isArray(t)){for(var a=new Array(o);++i<o;)a[i]=t[i];a._parent=t._parent,t=a}return t}return t._root=e(t._root,t._depth)}function u(t){function e(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}function n(){return this.ownerDocument.createElementNS(t.space,t.local)}return t=d.qualify(t),t.local?n:e}function s(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function l(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=new RegExp("(?:^|\\s+)"+_(t)+"(?:\\s+|$)","g"));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",p(i+" "+t))):n.setAttribute("class",p(i.replace(e," ")))}}function f(t,e,r){return function(i){for(var o=e.length,a=n.d3.event;--o>=0;)r[o<<1]=e[o].__data__;n.d3.event=i;try{t.apply(e[0],r)}finally{n.d3.event=a}}}function c(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function h(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function p(t){return t.trim().replace(/\s+/g," ")}function _(t){return t.replace(S,"\\$&")}var d=t("./namespace"),g=n.Map,v=n.document,y=n.CustomEvent,m=function(t){return function(){return t}},w=function(t){return function(){return this.querySelector(t)}},x=function(t){return function(){return this.querySelectorAll(t)}},b=function(t){return function(){return this.matches(t)}},A={mouseenter:"mouseover",mouseleave:"mouseout"},S=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;if(v){var E=v.documentElement;if(!E.matches){var C=E.webkitMatchesSelector||E.msMatchesSelector||E.mozMatchesSelector||E.oMatchesSelector;b=function(t){return function(){return C.call(this,t)}}}for(var M in A)"on"+M in v&&delete A[M];y||(y=function(t,e){var n=v.createEvent("CustomEvent");return e?n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):n.initCustomEvent(t,!1,!1,void 0),n},y.prototype=n.Event.prototype),E=M=null}g||(g=function(){},g.prototype={set:function(t,e){return this["$"+t]=e,this},get:function(t){return this["$"+t]},has:function(t){return"$"+t in this}}),r.prototype={select:function(t){function e(n,r){var o,a,u,s=-1,l=n.length,f=new Array(l);if(--r)for(var c=2*r,h=c+1;++s<l;)(a=n[s])&&(i[c]=a._parent.__data__,i[h]=s,f[s]=e(a,r));else for(o=n._update;++s<l;)(a=n[s])&&(i[0]=a.__data__,i[1]=s,(u=t.apply(a,i))&&("__data__"in a&&(u.__data__=a.__data__),o&&(o[s]=u,delete n[s]),f[s]=u));return f._parent=n._parent,f}var n=this._depth,i=new Array(2*n);return"function"!=typeof t&&(t=w(t)),new r(e(this._root,n),n)},selectAll:function(t){function e(n,r){var o,a,u=-1,s=n.length,l=new Array(s);if(--r)for(var f=2*r,c=f+1;++u<s;)(o=n[u])&&(i[f]=o._parent.__data__,i[c]=u,l[u]=e(o,r));else for(;++u<s;)(o=n[u])&&(i[0]=o.__data__,i[1]=u,l[u]=a=t.apply(o,i),a._parent=o);return l._parent=n._parent,l}var n=this._depth,i=new Array(2*n);return"function"!=typeof t&&(t=x(t)),new r(e(this._root,n),n+1)},filter:function(t){function e(n,r){var o,a,u=-1,s=n.length;if(--r){var l=2*r,f=l+1;for(a=new Array(s);++u<s;)(o=n[u])&&(i[l]=o._parent.__data__,i[f]=u,a[u]=e(o,r))}else for(a=[];++u<s;)(o=n[u])&&(i[0]=o.__data__,i[1]=u,t.apply(o,i)&&a.push(o));return a._parent=n._parent,a}var n=this._depth,i=new Array(2*n);return"function"!=typeof t&&(t=b(t)),new r(e(this._root,n),n)},data:function(t,e){function n(e,r){var i,o,a=-1;if(r--){var u=2*r,s=u+1;for(i=e.length;++a<i;)(o=e[a])&&(l[u]=o._parent.__data__,l[s]=a,n(o,r))}else{var c,h=0,p=e._enter;for(f(e,t.apply(e._parent,l)),i=e.length;++a<i;)if(c=p[a]){for(a>=h&&(h=a+1);!(o=e[h])&&++h<i;);c._next=o||null}}}function r(t,e){var n,r=0,o=t._enter,a=t._exit,u=t.length,s=e.length,l=Math.min(u,s);for(o.length=0,o.length=s,a.length=0,a.length=u;l>r;++r)(n=t[r])?n.__data__=e[r]:o[r]=new i(t._parent,e[r]);for(;s>r;++r)o[r]=new i(t._parent,e[r]);for(;u>r;++r)(n=t[r])&&(a[r]=t[r]);t.length=s}function o(t,n){var r,o,a,u=t._enter,s=t._exit,f=n.length,c=t.length,h=new g,p=[null,null].concat(l),_=new Array(c);for(u.length=0,u.length=f,s.length=0,s.length=c,r=0;c>r;++r)(o=t[r])&&(p[0]=o.__data__,p[1]=r,_[r]=a=e.apply(o,p),h.has(a)?(delete t[r],s[r]=o):h.set(a,o));for(t.length=0,t.length=f,r=0;f>r;++r)p[0]=n[r],p[1]=r,a=e.apply(t._parent,p),(o=h.get(a))?o!==!0&&(t[r]=o,o.__data__=n[r]):u[r]=new i(t._parent,n[r]),h.set(a,!0);for(r=0;c>r;++r)(o=h.get(_[r]))!==!0&&(s[r]=o)}if(!t){var a=new Array(this.size()),u=-1;return this.each(function(t){a[++u]=t}),a}var s=this._depth-1,l=new Array(2*s),f=e?o:r;return this.enter(),this.exit(),"function"!=typeof t&&(t=m(t)),n(this._root,s),this},enter:function(){function t(e,n){var r,i=-1,o=e.length,a=new Array(o);if(--n)for(;++i<o;)(r=e[i])&&(a[i]=t(r,n));else e._enter=a,a._update=e;return a._parent=e._parent,a}return this._enter||(this._enter=new r(t(a(this),this._depth),this._depth))},exit:function(){function t(e,n){var r,i=-1,o=e.length,a=new Array(o);if(--n)for(;++i<o;)(r=e[i])&&(a[i]=t(r,n));else e._exit=a;return a._parent=e._parent,a}return this._exit||(this._exit=new r(t(a(this),this._depth),this._depth))},order:function(){function t(e,n){var r,i,o=e.length;if(--n)for(;--o>=0;)(r=e[o])&&t(r,n);else for(i=e[--o];--o>=0;)(r=e[o])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r)}return t(this._root,this._depth),this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}function n(t,r){if(--r)for(var i,o=-1,a=t.length;++o<a;)(i=t[o])&&n(i,r);else t.sort(e)}return t||(t=h),n(a(this),this._depth),this.order()},call:function(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){function t(e,n){var r,i=-1,o=e.length;if(--n){for(;++i<o;)if((r=e[i])&&(r=t(r,n)))return r}else for(;++i<o;)if(r=e[i])return r}return t(this._root,this._depth)},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){function e(n,i){var o,a=-1,u=n.length;if(--i)for(var s=2*i,l=s+1;++a<u;)(o=n[a])&&(r[s]=o._parent.__data__,r[l]=a,e(o,i));else for(;++a<u;)(o=n[a])&&(r[0]=o.__data__,r[1]=a,t.apply(o,r))}var n=this._depth,r=new Array(n);return e(this._root,n),this},attr:function(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function u(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}if(t=d.qualify(t),arguments.length<2){var s=this.node();return t.local?s.getAttributeNS(t.space,t.local):s.getAttribute(t)}return this.each(null==e?t.local?r:n:"function"==typeof e?t.local?u:a:t.local?o:i)},style:function(t,e,n){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,n)}function o(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}var a=arguments.length;return 2>a?s(a=this.node()).getComputedStyle(a,null).getPropertyValue(t):(3>a&&(n=""),this.each(null==e?r:"function"==typeof e?o:i))},property:function(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return arguments.length<2?this.node()[t]:this.each(null==e?n:"function"==typeof e?i:r)},"class":function(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=(t+"").trim().split(/^|\s+/);var i=t.length;if(arguments.length<2){var o=this.node(),a=-1;if(e=o.classList){for(;++a<i;)if(!e.contains(t[a]))return!1}else for(e=o.getAttribute("class");++a<i;)if(!classedRe(t[a]).test(e))return!1;return!0}return t=t.map(l),this.each("function"==typeof e?r:n)},text:function(t){function e(){this.textContent=t}function n(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().textContent},html:function(t){function e(){this.innerHTML=t}function n(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().innerHTML},append:function(t,e){function n(){return this.appendChild(t.apply(this,arguments))}function r(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)}return"function"!=typeof t&&(t=u(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=w(e)),r))},remove:function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},event:function(t,e,n){function r(){for(var r=h,o=arguments.length>>1,a=new Array(o);--o>=0;)r=r[arguments[(o<<1)+1]],a[o]=o?r._parent:r;var s=f(e,a,arguments);u&&(s=c(s)),i.call(this),this.addEventListener(t,this[l]=s,s._capture=n),s._listener=e}function i(){var e=this[l];e&&(this.removeEventListener(t,e,e._capture),delete this[l])}function a(){var e,n=new RegExp("^__on([^.]+)"+_(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i._capture),delete this[r]}}var u,s=arguments.length,l="__on"+t,h=this._root;return 2>s?(s=this.node()[l])&&s._listener:(3>s&&(n=!1),(s=t.indexOf("."))>0&&(t=t.slice(0,s)),(u=A.hasOwnProperty(t))&&(t=A[t]),this.each(e?s?r:o:s?i:a))},dispatch:function(t,e){function n(){return this.dispatchEvent(new y(t,e))}function r(){return this.dispatchEvent(new y(t,e.apply(this,arguments)))}return this.each("function"==typeof e?r:n)}},r.select=function(t){return new r(["string"==typeof t?v.querySelector(t):t],1)},r.selectAll=function(t){return new r("string"==typeof t?v.querySelectorAll(t):t,1)},i.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./namespace":2}],4:[function(t,e,n){(function(n){var r=t("./lib/d3/event"),i=t("./lib/d3/namespace"),o=t("./lib/d3/selection"),a=e.exports=n.d3||(n.d3={});a.mouse=r.mouse,a.touch=r.touch,a.touches=r.touches,a.namespace=i.prefix,a.selection=o,a.select=o.select,a.selectAll=o.selectAll,a.ns=i,o.prototype.on=o.prototype.event,o.prototype.insert=o.prototype.append,o.prototype.classed=o.prototype["class"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/d3/event":1,"./lib/d3/namespace":2,"./lib/d3/selection":3}]},{},[4])(4)}); | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.d3=t()}}(function(){return function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){(function(t){function n(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}function r(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function i(t){function e(t,n){var r,i=-1,o=t.length;if(--n)for(;++i<o;)(r=t[i])&&(t[i]=e(r,n));else if(!Array.isArray(t)){for(var a=new Array(o);++i<o;)a[i]=t[i];a._parent=t._parent,t=a}return t}return t._root=e(t._root,t._depth)}function o(t){function e(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}function n(){return this.ownerDocument.createElementNS(t.space,t.local)}return t=p.namespace(t),t.local?n:e}function a(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function u(t,e,n){var r=a(t),i=r.CustomEvent;i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function s(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=new RegExp("(?:^|\\s+)"+b(t)+"(?:\\s+|$)","g"));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",A(i+" "+t))):n.setAttribute("class",A(i.replace(e," ")))}}function c(t,e,n){return function(r){for(var i=e.length,o=p.event;--i>=0;)n[i<<1]=e[i].__data__;p.event=r;try{t.apply(e[0],n)}finally{p.event=o}}}function l(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function f(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>E){var i=a(t);if(i.scrollX||i.scrollY){n=p.select(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n.node().getScreenCTM();E=!(o.f||o.e),n.remove()}}return E?(r.x=e.pageX,r.y=e.pageY):(r.x=e.clientX,r.y=e.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var u=t.getBoundingClientRect();return[e.clientX-u.left-t.clientLeft,e.clientY-u.top-t.clientTop]}function h(){for(var t,e=p.event;t=e.sourceEvent;)e=t;return e}var p=e.exports=t.d3||(t.d3={}),_=t.Map||(_=function(){},_.prototype={set:function(t,e){return this["$"+t]=e,this},get:function(t){return this["$"+t]},has:function(t){return"$"+t in this}},_),d=function(t){return function(){return t}},g=function(t){return function(){return this.querySelector(t)}},v=function(t){return function(){return this.querySelectorAll(t)}},m=function(t){return function(){return this.matches(t)}},y=new _,w=function(){},x=function(t,e){return e>t?-1:t>e?1:t>=e?0:NaN},A=function(t){return t.trim().replace(/\s+/g," ")},b=function(t){return t.replace(S,"\\$&")},S=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,E=t.navigator&&/WebKit/.test(t.navigator.userAgent)?-1:0;!function(t){if(t){var e=t.documentElement;if("onmouseenter"in e||y.set("mouseenter","mouseover").set("mouseleave","mouseout"),!e.matches){var n=e.webkitMatchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector;m=function(t){return function(){return n.call(this,t)}}}}}(t.document),p.namespaces=(new _).set("svg","http://www.w3.org/2000/svg").set("xhtml","http://www.w3.org/1999/xhtml").set("xlink","http://www.w3.org/1999/xlink").set("xml","http://www.w3.org/XML/1998/namespace").set("xmlns","http://www.w3.org/2000/xmlns/"),p.namespace=function(t){var e=t.indexOf(":"),n=t;return e>=0&&(n=t.slice(0,e),t=t.slice(e+1)),p.namespaces.has(n)?{space:p.namespaces.get(n),local:t}:t},p.selection=n,n.prototype={select:function(t){function e(n,r,o){var a,u,s=-1,c=n.length,l=new Array(c);if(--o)for(var f=2*o,h=f+1;++s<c;)(a=n[s])&&(i[f]=a._parent.__data__,i[h]=s,l[s]=e(a,r&&r[s],o));else for(;++s<c;)(a=n[s])&&(i[0]=a.__data__,i[1]=s,(u=t.apply(a,i))&&("__data__"in a&&(u.__data__=a.__data__),r&&(r[s]=u,delete n[s]),l[s]=u));return l._parent=n._parent,l}var r=this._depth,i=new Array(2*r);return"function"!=typeof t&&(t=g(t)),new n(e(this._root,this._update&&this._update._root,r),r)},selectAll:function(t){function e(n,r){var o,a,u=-1,s=n.length,c=new Array(s);if(--r)for(var l=2*r,f=l+1;++u<s;)(o=n[u])&&(i[l]=o._parent.__data__,i[f]=u,c[u]=e(o,r));else for(;++u<s;)(o=n[u])&&(i[0]=o.__data__,i[1]=u,c[u]=a=t.apply(o,i),a._parent=o);return c._parent=n._parent,c}var r=this._depth,i=new Array(2*r);return"function"!=typeof t&&(t=v(t)),new n(e(this._root,r),r+1)},filter:function(t){function e(n,r){var o,a,u=-1,s=n.length;if(--r){var c=2*r,l=c+1;for(a=new Array(s);++u<s;)(o=n[u])&&(i[c]=o._parent.__data__,i[l]=u,a[u]=e(o,r))}else for(a=[];++u<s;)(o=n[u])&&(i[0]=o.__data__,i[1]=u,t.apply(o,i)&&a.push(o));return a._parent=n._parent,a}var r=this._depth,i=new Array(2*r);return"function"!=typeof t&&(t=m(t)),new n(e(this._root,r),r)},data:function(t,e){function n(e,r,i,o){var a,u,s=-1;if(o--){var f=2*o,h=f+1;for(a=e.length;++s<a;)(u=e[s])&&(c[f]=u._parent.__data__,c[h]=s,n(u,r[s],i[s],o))}else{var p,_=0;for(l(e,r,i,t.apply(e._parent,c)),a=e.length;++s<a;)if(p=r[s]){for(s>=_&&(_=s+1);!(u=e[_])&&++_<a;);p._next=u||null}}}function i(t,e,n,i){var o,a=0,u=t.length,s=i.length,c=Math.min(u,s);for(e.length=0,e.length=s,n.length=0,n.length=u;c>a;++a)(o=t[a])?o.__data__=i[a]:e[a]=new r(t._parent,i[a]);for(;s>a;++a)e[a]=new r(t._parent,i[a]);for(;u>a;++a)(o=t[a])&&(n[a]=t[a]);t.length=s}function o(t,n,i,o){var a,u,s,l=o.length,f=t.length,h=new _,p=[null,null].concat(c),d=new Array(f);for(n.length=0,n.length=l,i.length=0,i.length=f,a=0;f>a;++a)(u=t[a])&&(p[0]=u.__data__,p[1]=a,d[a]=s=e.apply(u,p),h.has(s)?i[a]=u:h.set(s,u));for(t.length=0,t.length=l,a=0;l>a;++a)p[0]=o[a],p[1]=a,s=e.apply(t._parent,p),(u=h.get(s))?u!==!0&&(t[a]=u,u.__data__=o[a]):n[a]=new r(t._parent,o[a]),h.set(s,!0);for(a=0;f>a;++a)(u=h.get(d[a]))!==!0&&(i[a]=u)}if(!t){var a=new Array(this.size()),u=-1;return this.each(function(t){a[++u]=t}),a}var s=this._depth-1,c=new Array(2*s),l=e?o:i;return"function"!=typeof t&&(t=d(t)),n(this._root,this.enter()._root,this.exit()._root,s),this},enter:function(){function t(e,n){var r,i=-1,o=e.length,a=new Array(o);if(--n)for(;++i<o;)(r=e[i])&&(a[i]=t(r,n));return a._parent=e._parent,a}return this._enter?this._enter:(this._enter=new n(t(i(this),this._depth),this._depth),this._enter._update=this,this._enter)},exit:function(){function t(e,n){var r,i=-1,o=e.length,a=new Array(o);if(--n)for(;++i<o;)(r=e[i])&&(a[i]=t(r,n));return a._parent=e._parent,a}return this._exit||(this._exit=new n(t(i(this),this._depth),this._depth))},order:function(){function t(e,n){var r,i,o=e.length;if(--n)for(;--o>=0;)(r=e[o])&&t(r,n);else for(i=e[--o];--o>=0;)(r=e[o])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r)}return t(this._root,this._depth),this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}function n(t,r){if(--r)for(var i,o=-1,a=t.length;++o<a;)(i=t[o])&&n(i,r);else t.sort(e)}return t||(t=x),n(i(this),this._depth),this.order()},call:function(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){function t(e,n){var r,i=-1,o=e.length;if(--n){for(;++i<o;)if((r=e[i])&&(r=t(r,n)))return r}else for(;++i<o;)if(r=e[i])return r}return t(this._root,this._depth)},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){function e(n,i){var o,a=-1,u=n.length;if(--i)for(var s=2*i,c=s+1;++a<u;)(o=n[a])&&(r[s]=o._parent.__data__,r[c]=a,e(o,i));else for(;++a<u;)(o=n[a])&&(r[0]=o.__data__,r[1]=a,t.apply(o,r))}var n=this._depth,r=new Array(n);return e(this._root,n),this},attr:function(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function u(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}if(t=p.namespace(t),arguments.length<2){var s=this.node();return t.local?s.getAttributeNS(t.space,t.local):s.getAttribute(t)}return this.each(null==e?t.local?r:n:"function"==typeof e?t.local?u:a:t.local?o:i)},style:function(t,e,n){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,n)}function o(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}var u=arguments.length;return 2>u?a(u=this.node()).getComputedStyle(u,null).getPropertyValue(t):(3>u&&(n=""),this.each(null==e?r:"function"==typeof e?o:i))},property:function(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return arguments.length<2?this.node()[t]:this.each(null==e?n:"function"==typeof e?i:r)},"class":function(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=(t+"").trim().split(/^|\s+/);var i=t.length;if(arguments.length<2){var o=this.node(),a=-1;if(e=o.classList){for(;++a<i;)if(!e.contains(t[a]))return!1}else for(e=o.getAttribute("class");++a<i;)if(!classedRe(t[a]).test(e))return!1;return!0}return t=t.map(s),this.each("function"==typeof e?r:n)},text:function(t){function e(){this.textContent=t}function n(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().textContent},html:function(t){function e(){this.innerHTML=t}function n(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().innerHTML},append:function(t,e){function n(){return this.appendChild(t.apply(this,arguments))}function r(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)}return"function"!=typeof t&&(t=o(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=g(e)),r))},remove:function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},event:function(t,e,n){function r(){for(var r=f,o=arguments.length>>1,u=new Array(o);--o>=0;)r=r[arguments[(o<<1)+1]],u[o]=o?r._parent:r;var h=c(e,u,arguments);a&&(h=l(h)),i.call(this),this.addEventListener(t,this[s]=h,h._capture=n),h._listener=e}function i(){var e=this[s];e&&(this.removeEventListener(t,e,e._capture),delete this[s])}function o(){var e,n=new RegExp("^__on([^.]+)"+b(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i._capture),delete this[r]}}var a,u=arguments.length,s="__on"+t,f=this._root;return 2>u?(u=this.node()[s])&&u._listener:(3>u&&(n=!1),(u=t.indexOf("."))>0&&(t=t.slice(0,u)),(a=y.has(t))&&(t=y.get(t)),this.each(e?u?r:w:u?i:o))},dispatch:function(t,e){function n(){return u(this,t,e)}function r(){return u(this,t,e.apply(this,arguments))}return this.each("function"==typeof e?r:n)}},n.prototype.on=n.prototype.event,n.prototype.insert=n.prototype.append,n.prototype.classed=n.prototype["class"],p.select=function(e){var r;if("string"==typeof e){var i=t.document;r=[i.querySelector(e)],r._parent=i.documentElement}else r=[e],r._parent=null;return new n(r,1)},p.selectAll=function(e){var r;if("string"==typeof e){var i=t.document;r=i.querySelectorAll(e),r._parent=i.documentElement}else r=e,r._parent=null;return new n(r,1)},r.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}},p.mouse=function(t,e){return arguments.length<2&&(e=h()),e.changedTouches&&(e=e.changedTouches[0]),f(t,e)},p.touch=function(t,e,n){arguments.length<3&&(n=e,e=h().changedTouches);for(var r,i=0,o=e?e.length:0;o>i;++i)if((r=e[i]).identifier===n)return f(t,r);return null},p.touches=function(t,e){arguments.length<2&&(e=h().touches);for(var n=0,r=e?e.length:0,i=new Array(r);r>n;++n)i[n]=f(t,e[n]);return i}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); |
{ | ||
"name": "d3-selection", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Data-driven DOM manipulation.", | ||
"main": "lib/d3/selection", | ||
"main": "index", | ||
"repository": { | ||
@@ -7,0 +7,0 @@ "type": "git", |
@@ -31,6 +31,6 @@ # d3-selection | ||
* The d3.ns.prefix namespace map is now exposed as d3.namespace. The old name is deprecated but preserved for backwards-compatibility. | ||
* [Multi-value map](http://bl.ocks.org/mbostock/3305515) variants of selection.attr, selection.style, selection.property, selection.class and selection.on are now implemented as distinct methods in the [d3-selection-multi plugin](https://github.com/d3/d3-selection-multi), rather than overloading the arguments. See [#2109](https://github.com/mbostock/d3/issues/2109). | ||
* The d3.ns.prefix namespace map has been renamed to d3.namespaces and is now a Map rather than an object. The d3.ns.qualify method has likewise been renamed to d3.namespace. | ||
* Removed support for Sizzle. It’s time. |
@@ -6,5 +6,7 @@ var tape = require("tape"), | ||
tape("can load as AMD module", function(test) { | ||
delete global.d3; | ||
requirejs([path.join(__dirname, "../d3-selection")], function(d3) { | ||
test.equal(typeof d3.select, "function", "d3.select is a function"); | ||
test.end(); | ||
delete global.d3; | ||
}); | ||
@@ -14,6 +16,8 @@ }); | ||
tape("can load as minified AMD module", function(test) { | ||
delete global.d3; | ||
requirejs([path.join(__dirname, "../d3-selection.min")], function(d3) { | ||
test.equal(typeof d3.select, "function", "d3.select is a function"); | ||
test.end(); | ||
delete global.d3; | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104341
18
2296
1