Socket
Socket
Sign inDemoInstall

d3-selection

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-selection - npm Package Compare versions

Comparing version 0.4.9 to 0.4.10

build/selection.cjs.js

219

build/selection.js

@@ -7,35 +7,2 @@ (function (global, factory) {

function _defaultView(node) {
return node
&& ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|| (node.document && node) // node is a Window
|| node.defaultView); // node is a Document
}
function selection_dispatch(type, params) {
function dispatchConstant() {
return dispatchEvent(this, type, params);
}
function dispatchFunction() {
return dispatchEvent(this, type, params.apply(this, arguments));
}
return this.each(typeof params === "function" ? dispatchFunction : dispatchConstant);
}function dispatchEvent(node, type, params) {
var window = _defaultView(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);
}
var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;

@@ -45,11 +12,11 @@

return string.replace(requoteRe, "\\$&");
}
};
var filterEvents = {};
exports.event = null;
exports.event$1 = null;
if (typeof document !== "undefined") {
var _element = document.documentElement;
if (!("onmouseenter" in _element)) {
var element = document.documentElement;
if (!("onmouseenter" in element)) {
filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};

@@ -103,11 +70,13 @@ }

: (n ? remove : removeAll));
}function listenerOf(listener, ancestors, args) {
};
function listenerOf(listener, ancestors, args) {
return function(event1) {
var i = ancestors.length, event0 = exports.event; // Events can be reentrant (e.g., focus).
var i = ancestors.length, event0 = exports.event$1; // Events can be reentrant (e.g., focus).
while (--i >= 0) args[i << 1] = ancestors[i].__data__;
exports.event = event1;
exports.event$1 = event1;
try {
listener.apply(ancestors[0], args);
} finally {
exports.event = event0;
exports.event$1 = event0;
}

@@ -128,5 +97,46 @@ };

function sourceEvent() {
var current = exports.event$1, source;
while (source = current.sourceEvent) current = source;
return current;
};
function defaultView$1(node) {
return node
&& ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|| (node.document && node) // node is a Window
|| node.defaultView); // node is a Document
};
function selection_dispatch(type, params) {
function dispatchConstant() {
return dispatchEvent(this, type, params);
}
function dispatchFunction() {
return dispatchEvent(this, type, params.apply(this, arguments));
}
return this.each(typeof params === "function" ? dispatchFunction : dispatchConstant);
};
function dispatchEvent(node, type, params) {
var window = defaultView$1(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 selection_datum(value) {
return arguments.length ? this.property("__data__", value) : this.node().__data__;
}
};

@@ -138,10 +148,4 @@ function selection_remove() {

});
}
};
function selectorOf(selector) {
return function() {
return this.querySelector(selector);
};
}
var namespaces = {

@@ -159,4 +163,10 @@ svg: "http://www.w3.org/2000/svg",

return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;
}
};
function selectorOf(selector) {
return function() {
return this.querySelector(selector);
};
};
function selection_append(creator, selector) {

@@ -176,3 +186,5 @@ if (typeof creator !== "function") creator = creatorOf(creator);

: (typeof selector !== "function" && (selector = selectorOf(selector)), insert));
}function creatorOf(name) {
};
function creatorOf(name) {
name = namespace(name);

@@ -210,3 +222,3 @@

return this.each(typeof value === "function" ? setFunction : setConstant);
}
};

@@ -228,3 +240,3 @@ function selection_text(value) {

return this.each(typeof value === "function" ? setFunction : setConstant);
}
};

@@ -259,3 +271,5 @@ function selection_class(name, value) {

return this.each(typeof value === "function" ? setFunction : setConstant);
}function classerOf(name) {
};
function classerOf(name) {
var re;

@@ -301,3 +315,3 @@ return function(node, value) {

return this.each(value == null ? remove : typeof value === "function" ? setFunction : setConstant);
}
};

@@ -307,3 +321,3 @@ function selection_style(name, value, priority) {

if (n < 2) return _defaultView(n = this.node()).getComputedStyle(n, null).getPropertyValue(name);
if (n < 2) return defaultView$1(n = this.node()).getComputedStyle(n, null).getPropertyValue(name);

@@ -327,3 +341,3 @@ if (n < 3) priority = "";

return this.each(value == null ? remove : typeof value === "function" ? setFunction : setConstant);
}
};

@@ -373,3 +387,3 @@ function selection_attr(name, value) {

: (name.local ? setConstantNS : setConstant)));
}
};

@@ -408,7 +422,7 @@ function selection_each(callback) {

return this;
}
};
function selection_empty() {
return !this.node();
}
};

@@ -419,7 +433,9 @@ function selection_size() {

return size;
}
};
function selection_node() {
return firstNode(this._root, this._depth);
}function firstNode(nodes, depth) {
};
function firstNode(nodes, depth) {
var i = -1,

@@ -452,3 +468,3 @@ n = nodes.length,

return nodes;
}
};

@@ -459,3 +475,3 @@ function selection_call() {

return this;
}
};

@@ -466,3 +482,5 @@ // The leaf groups of the selection hierarchy are initially NodeList,

return selection._root = arrayifyNode(selection._root, selection._depth);
}function arrayifyNode(nodes, depth) {
};
function arrayifyNode(nodes, depth) {
var i = -1,

@@ -516,3 +534,5 @@ n = nodes.length,

return this.order();
}function ascending(a, b) {
};
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;

@@ -524,3 +544,5 @@ }

return this;
}function orderNode(nodes, depth) {
};
function orderNode(nodes, depth) {
var i = nodes.length,

@@ -551,3 +573,5 @@ node,

return new Selection(emptyNode(arrayify(selection), selection._depth), selection._depth);
}function emptyNode(nodes, depth) {
};
function emptyNode(nodes, depth) {
var i = -1,

@@ -574,3 +598,3 @@ n = nodes.length,

return this._exit || (this._exit = emptyOf(this));
}
};

@@ -585,3 +609,3 @@ // Lazily constructs the enter selection for this (update) selection.

return this._enter;
}
};

@@ -752,3 +776,5 @@ var keyPrefix = "$";

return this;
}function EnterNode(parent, datum) {
};
function EnterNode(parent, datum) {
this.ownerDocument = parent.ownerDocument;

@@ -817,3 +843,5 @@ this.namespaceURI = parent.namespaceURI;

return new Selection(visit(this._root, depth), depth);
}var filterOf = function(selector) {
};
var filterOf = function(selector) {
return function() {

@@ -825,5 +853,5 @@ return this.matches(selector);

if (typeof document !== "undefined") {
var element = document.documentElement;
if (!element.matches) {
var vendorMatches = element.webkitMatchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector;
var element$1 = document.documentElement;
if (!element$1.matches) {
var vendorMatches = element$1.webkitMatchesSelector || element$1.msMatchesSelector || element$1.mozMatchesSelector || element$1.oMatchesSelector;
filterOf = function(selector) { return function() { return vendorMatches.call(this, selector); }; };

@@ -877,3 +905,5 @@ }

return new Selection(visit(this._root, depth), depth + 1);
}function selectorAllOf(selector) {
};
function selectorAllOf(selector) {
return function() {

@@ -932,3 +962,3 @@ return this.querySelectorAll(selector);

return new Selection(visit(this._root, this._update && this._update._root, depth), depth);
}
};

@@ -943,7 +973,9 @@ // When depth = 1, root = [Node, …].

this._enter = this._update = this._exit = null;
}function _selection() {
};
function selection() {
return new Selection([document.documentElement], 1);
}
Selection.prototype = _selection.prototype = {
Selection.prototype = selection.prototype = {
select: selection_select,

@@ -981,3 +1013,3 @@ selectAll: selection_selectAll,

return new Selection([typeof selector === "string" ? document.querySelector(selector) : selector], 1);
}
};

@@ -1006,11 +1038,5 @@ var bug44083 = typeof navigator !== "undefined" && /WebKit/.test(navigator.userAgent) ? -1 : 0; // https://bugs.webkit.org/show_bug.cgi?id=44083

return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
}
};
function sourceEvent() {
var current = exports.event, source;
while (source = current.sourceEvent) current = source;
return current;
}
function _touches(node, touches) {
function touches(node, touches) {
if (arguments.length < 2) touches = sourceEvent().touches;

@@ -1021,5 +1047,5 @@ for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {

return points;
}
};
function touch(node, touches, identifier) {
function touch$1(node, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;

@@ -1032,7 +1058,7 @@ for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {

return null;
}
};
function selectAll(selector) {
return new Selection(typeof selector === "string" ? document.querySelectorAll(selector) : selector, 1);
}
};

@@ -1043,4 +1069,5 @@ function mouse(node, event) {

return point(node, event);
}
};
exports.event = exports.event$1;
exports.mouse = mouse;

@@ -1052,6 +1079,6 @@ exports.namespace = namespace;

exports.selectAll = selectAll;
exports.selection = _selection;
exports.touch = touch;
exports.touches = _touches;
exports.selection = selection;
exports.touch = touch$1;
exports.touches = touches;
}));

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.selection={})}(this,function(t){"use strict";function e(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function n(t,e){function n(){return r(this,t,e)}function i(){return r(this,t,e.apply(this,arguments))}return this.each("function"==typeof e?i:n)}function r(t,n,r){var i=e(t),o=i.CustomEvent;o?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),t.dispatchEvent(o)}function i(t){return t.replace(rt,"\\$&")}function o(t,e,n){function r(){for(var r=p,i=arguments.length>>1,s=new Array(i);--i>=0;)r=r[arguments[(i<<1)+1]],s[i]=i?r._parent:r;var c=a(e,s,arguments);l&&(c=u(c)),o.call(this),this.addEventListener(t,this[f]=c,c._capture=n),c._listener=e}function o(){var e=this[f];e&&(this.removeEventListener(t,e,e._capture),delete this[f])}function c(){var e,n=new RegExp("^__on([^.]+)"+i(t)+"$");for(var r in this)if(e=r.match(n)){var o=this[r];this.removeEventListener(e[1],o,o._capture),delete this[r]}}var l,h=arguments.length,f="__on"+t,p=this._root;return 2>h?(h=this.node()[f])&&h._listener:(3>h&&(n=!1),(h=t.indexOf("."))>0&&(t=t.slice(0,h)),(l=it.hasOwnProperty(t))&&(t=it[t]),this.each(e?h?r:s:h?o:c))}function a(e,n,r){return function(i){for(var o=n.length,a=t.event;--o>=0;)r[o<<1]=n[o].__data__;t.event=i;try{e.apply(n[0],r)}finally{t.event=a}}}function u(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function s(){}function c(t){return arguments.length?this.property("__data__",t):this.node().__data__}function l(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})}function h(t){return function(){return this.querySelector(t)}}function f(t){var e=t.indexOf(":"),n=t;return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),at.hasOwnProperty(n)?{space:at[n],local:t}:t}function p(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=_(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=h(e)),r))}function _(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=f(t),t.local?n:e}function d(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}function g(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}function m(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(!w(t[a]).test(e))return!1;return!0}return t=t.map(v),this.each("function"==typeof e?r:n)}function v(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=w(t));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",y(i+" "+t))):n.setAttribute("class",y(i.replace(e," ")))}}function y(t){return t.trim().replace(/\s+/g," ")}function w(t){return new RegExp("(?:^|\\s+)"+i(t)+"(?:\\s+|$)","g")}function A(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)}function x(t,n,r){function i(){this.style.removeProperty(t)}function o(){this.style.setProperty(t,n,r)}function a(){var e=n.apply(this,arguments);null==e?this.style.removeProperty(t):this.style.setProperty(t,e,r)}var u=arguments.length;return 2>u?e(u=this.node()).getComputedStyle(u,null).getPropertyValue(t):(3>u&&(r=""),this.each(null==n?i:"function"==typeof n?a:o))}function b(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=f(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)}function S(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}function E(){return!this.node()}function C(){var t=0;return this.each(function(){++t}),t}function M(){return N(this._root,this._depth)}function N(t,e){var n,r=-1,i=t.length;if(--e){for(;++r<i;)if((n=t[r])&&(n=N(n,e)))return n}else for(;++r<i;)if(n=t[r])return n}function T(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t}function L(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this}function P(t){return t._root=D(t._root,t._depth)}function D(t,e){var n,r=-1,i=t.length;if(--e)for(;++r<i;)(n=t[r])&&(t[r]=D(n,e));else if(!Array.isArray(t)){for(var o=new Array(i);++r<i;)o[r]=t[r];o._parent=t._parent,t=o}return t}function V(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=B),n(P(this),this._depth),this.order()}function B(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function R(){return q(this._root,this._depth),this}function q(t,e){var n,r,i=t.length;if(--e)for(;--i>=0;)(n=t[i])&&q(n,e);else for(r=t[--i];--i>=0;)(n=t[i])&&(r&&r!==n.nextSibling&&r.parentNode.insertBefore(n,r),r=n)}function X(t){return new K($(P(t),t._depth),t._depth)}function $(t,e){var n,r=-1,i=t.length,o=new Array(i);if(--e)for(;++r<i;)(n=t[r])&&(o[r]=$(n,e));return o._parent=t._parent,o}function z(){return this._exit||(this._exit=X(this))}function I(){return this._enter||(this._enter=X(this),this._enter._update=this),this._enter}function O(t,e){function n(e,r,i,o){var a,u,l=-1;if(o--){var h=2*o,f=h+1;for(a=e.length;++l<a;)(u=e[l])&&(s[h]=u._parent.__data__,s[f]=l,n(u,r[l],i[l],o))}else{var p,_=0;for(c(e,r,i,t.apply(e._parent,s)),a=e.length;++l<a;)if(p=r[l]){for(l>=_&&(_=l+1);!(u=e[_])&&++_<a;);p._next=u||null}}}function r(t,e,n,r){var i,o=0,a=t.length,u=r.length,s=Math.min(a,u);for(e.length=0,e.length=u,n.length=0,n.length=a;s>o;++o)(i=t[o])?i.__data__=r[o]:e[o]=new Y(t._parent,r[o]);for(;u>o;++o)e[o]=new Y(t._parent,r[o]);for(;a>o;++o)(i=t[o])&&(n[o]=t[o]);t.length=u}function i(t,n,r,i){var o,a,u,c=i.length,l=t.length,h={},f=new Array(2).concat(s),p=new Array(l);for(n.length=0,n.length=c,r.length=0,r.length=l,o=0;l>o;++o)(a=t[o])&&(f[0]=a.__data__,f[1]=o,p[o]=u=ut+e.apply(a,f),h[u]?r[o]=a:h[u]=a);for(t.length=0,t.length=c,o=0;c>o;++o)f[0]=i[o],f[1]=o,u=ut+e.apply(t._parent,f),(a=h[u])?a!==!0&&(t[o]=a,a.__data__=i[o]):n[o]=new Y(t._parent,i[o]),h[u]=!0;for(o=0;l>o;++o)(a=h[p[o]])!==!0&&(r[o]=a)}if(!t){var o=new Array(this.size()),a=-1;return this.each(function(t){o[++a]=t}),o}var u=this._depth-1,s=new Array(2*u),c=e?i:r;return"function"!=typeof t&&(t=k(t)),n(this._root,this.enter()._root,this.exit()._root,u),this}function Y(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function k(t){return function(){return t}}function G(t){function e(n,i){var o,a,u=-1,s=n.length;if(--i){var c=2*i,l=c+1;for(a=new Array(s);++u<s;)(o=n[u])&&(r[c]=o._parent.__data__,r[l]=u,a[u]=e(o,i))}else for(a=[];++u<s;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,t.apply(o,r)&&a.push(o));return a._parent=n._parent,a}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=st(t)),new K(e(this._root,n),n)}function H(t){function e(n,i){var o,a,u=-1,s=n.length,c=new Array(s);if(--i)for(var l=2*i,h=l+1;++u<s;)(o=n[u])&&(r[l]=o._parent.__data__,r[h]=u,c[u]=e(o,i));else for(;++u<s;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,c[u]=a=t.apply(o,r),a._parent=o);return c._parent=n._parent,c}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=U(t)),new K(e(this._root,n),n+1)}function U(t){return function(){return this.querySelectorAll(t)}}function j(t){function e(n,i,o){var a,u,s=-1,c=n.length,l=new Array(c);if(--o)for(var h=2*o,f=h+1;++s<c;)(a=n[s])&&(r[h]=a._parent.__data__,r[f]=s,l[s]=e(a,i&&i[s],o));else for(;++s<c;)(a=n[s])&&(r[0]=a.__data__,r[1]=s,(u=t.apply(a,r))&&("__data__"in a&&(u.__data__=a.__data__),i&&(i[s]=u,delete n[s]),l[s]=u));return l._parent=n._parent,l}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=h(t)),new K(e(this._root,this._update&&this._update._root,n),n)}function K(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}function W(){return new K([document.documentElement],1)}function F(t){return new K(["string"==typeof t?document.querySelector(t):t],1)}function J(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>ht){var i=defaultView(t);if(i.scrollX||i.scrollY){n=F(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n.node().getScreenCTM();ht=!(o.f||o.e),n.remove()}}return ht?(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 a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}function Q(){for(var e,n=t.event;e=n.sourceEvent;)n=e;return n}function Z(t,e){arguments.length<2&&(e=Q().touches);for(var n=0,r=e?e.length:0,i=new Array(r);r>n;++n)i[n]=J(t,e[n]);return i}function tt(t,e,n){arguments.length<3&&(n=e,e=Q().changedTouches);for(var r,i=0,o=e?e.length:0;o>i;++i)if((r=e[i]).identifier===n)return J(t,r);return null}function et(t){return new K("string"==typeof t?document.querySelectorAll(t):t,1)}function nt(t,e){return arguments.length<2&&(e=Q()),e.changedTouches&&(e=e.changedTouches[0]),J(t,e)}var rt=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,it={};if(t.event=null,"undefined"!=typeof document){var ot=document.documentElement;"onmouseenter"in ot||(it={mouseenter:"mouseover",mouseleave:"mouseout"})}var at={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/"},ut="$";Y.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}};var st=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var ct=document.documentElement;if(!ct.matches){var lt=ct.webkitMatchesSelector||ct.msMatchesSelector||ct.mozMatchesSelector||ct.oMatchesSelector;st=function(t){return function(){return lt.call(this,t)}}}}K.prototype=W.prototype={select:j,selectAll:H,filter:G,data:O,enter:I,exit:z,order:R,sort:V,call:L,nodes:T,node:M,size:C,empty:E,each:S,attr:b,style:x,property:A,"class":m,classed:m,text:g,html:d,append:p,insert:p,remove:l,datum:c,event:o,on:o,dispatch:n};var ht="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0;t.mouse=nt,t.namespace=f,t.namespaces=at,t.requote=i,t.select=F,t.selectAll=et,t.selection=W,t.touch=tt,t.touches=Z});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.selection={})}(this,function(t){"use strict";function e(t){return t.replace(rt,"\\$&")}function n(t,n,a){function u(){for(var e=p,o=arguments.length>>1,u=new Array(o);--o>=0;)e=e[arguments[(o<<1)+1]],u[o]=o?e._parent:e;var c=r(n,u,arguments);l&&(c=i(c)),s.call(this),this.addEventListener(t,this[f]=c,c._capture=a),c._listener=n}function s(){var e=this[f];e&&(this.removeEventListener(t,e,e._capture),delete this[f])}function c(){var n,r=new RegExp("^__on([^.]+)"+e(t)+"$");for(var i in this)if(n=i.match(r)){var o=this[i];this.removeEventListener(n[1],o,o._capture),delete this[i]}}var l,h=arguments.length,f="__on"+t,p=this._root;return 2>h?(h=this.node()[f])&&h._listener:(3>h&&(a=!1),(h=t.indexOf("."))>0&&(t=t.slice(0,h)),(l=it.hasOwnProperty(t))&&(t=it[t]),this.each(n?h?u:o:h?s:c))}function r(e,n,r){return function(i){for(var o=n.length,a=t.event$1;--o>=0;)r[o<<1]=n[o].__data__;t.event$1=i;try{e.apply(n[0],r)}finally{t.event$1=a}}}function i(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function o(){}function a(){for(var e,n=t.event$1;e=n.sourceEvent;)n=e;return n}function u(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function s(t,e){function n(){return c(this,t,e)}function r(){return c(this,t,e.apply(this,arguments))}return this.each("function"==typeof e?r:n)}function c(t,e,n){var r=u(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 l(t){return arguments.length?this.property("__data__",t):this.node().__data__}function h(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})}function f(t){var e=t.indexOf(":"),n=t;return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),at.hasOwnProperty(n)?{space:at[n],local:t}:t}function p(t){return function(){return this.querySelector(t)}}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=d(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=p(e)),r))}function d(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=f(t),t.local?n:e}function g(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}function v(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}function m(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(!A(t[a]).test(e))return!1;return!0}return t=t.map(y),this.each("function"==typeof e?r:n)}function y(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=A(t));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",w(i+" "+t))):n.setAttribute("class",w(i.replace(e," ")))}}function w(t){return t.trim().replace(/\s+/g," ")}function A(t){return new RegExp("(?:^|\\s+)"+e(t)+"(?:\\s+|$)","g")}function x(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)}function b(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?u(a=this.node()).getComputedStyle(a,null).getPropertyValue(t):(3>a&&(n=""),this.each(null==e?r:"function"==typeof e?o:i))}function S(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=f(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)}function E(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}function C(){return!this.node()}function M(){var t=0;return this.each(function(){++t}),t}function N(){return T(this._root,this._depth)}function T(t,e){var n,r=-1,i=t.length;if(--e){for(;++r<i;)if((n=t[r])&&(n=T(n,e)))return n}else for(;++r<i;)if(n=t[r])return n}function $(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t}function L(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this}function P(t){return t._root=D(t._root,t._depth)}function D(t,e){var n,r=-1,i=t.length;if(--e)for(;++r<i;)(n=t[r])&&(t[r]=D(n,e));else if(!Array.isArray(t)){for(var o=new Array(i);++r<i;)o[r]=t[r];o._parent=t._parent,t=o}return t}function V(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=B),n(P(this),this._depth),this.order()}function B(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function R(){return q(this._root,this._depth),this}function q(t,e){var n,r,i=t.length;if(--e)for(;--i>=0;)(n=t[i])&&q(n,e);else for(r=t[--i];--i>=0;)(n=t[i])&&(r&&r!==n.nextSibling&&r.parentNode.insertBefore(n,r),r=n)}function X(t){return new W(z(P(t),t._depth),t._depth)}function z(t,e){var n,r=-1,i=t.length,o=new Array(i);if(--e)for(;++r<i;)(n=t[r])&&(o[r]=z(n,e));return o._parent=t._parent,o}function I(){return this._exit||(this._exit=X(this))}function O(){return this._enter||(this._enter=X(this),this._enter._update=this),this._enter}function Y(t,e){function n(e,r,i,o){var a,u,l=-1;if(o--){var h=2*o,f=h+1;for(a=e.length;++l<a;)(u=e[l])&&(s[h]=u._parent.__data__,s[f]=l,n(u,r[l],i[l],o))}else{var p,_=0;for(c(e,r,i,t.apply(e._parent,s)),a=e.length;++l<a;)if(p=r[l]){for(l>=_&&(_=l+1);!(u=e[_])&&++_<a;);p._next=u||null}}}function r(t,e,n,r){var i,o=0,a=t.length,u=r.length,s=Math.min(a,u);for(e.length=0,e.length=u,n.length=0,n.length=a;s>o;++o)(i=t[o])?i.__data__=r[o]:e[o]=new k(t._parent,r[o]);for(;u>o;++o)e[o]=new k(t._parent,r[o]);for(;a>o;++o)(i=t[o])&&(n[o]=t[o]);t.length=u}function i(t,n,r,i){var o,a,u,c=i.length,l=t.length,h={},f=new Array(2).concat(s),p=new Array(l);for(n.length=0,n.length=c,r.length=0,r.length=l,o=0;l>o;++o)(a=t[o])&&(f[0]=a.__data__,f[1]=o,p[o]=u=ut+e.apply(a,f),h[u]?r[o]=a:h[u]=a);for(t.length=0,t.length=c,o=0;c>o;++o)f[0]=i[o],f[1]=o,u=ut+e.apply(t._parent,f),(a=h[u])?a!==!0&&(t[o]=a,a.__data__=i[o]):n[o]=new k(t._parent,i[o]),h[u]=!0;for(o=0;l>o;++o)(a=h[p[o]])!==!0&&(r[o]=a)}if(!t){var o=new Array(this.size()),a=-1;return this.each(function(t){o[++a]=t}),o}var u=this._depth-1,s=new Array(2*u),c=e?i:r;return"function"!=typeof t&&(t=G(t)),n(this._root,this.enter()._root,this.exit()._root,u),this}function k(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function G(t){return function(){return t}}function H(t){function e(n,i){var o,a,u=-1,s=n.length;if(--i){var c=2*i,l=c+1;for(a=new Array(s);++u<s;)(o=n[u])&&(r[c]=o._parent.__data__,r[l]=u,a[u]=e(o,i))}else for(a=[];++u<s;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,t.apply(o,r)&&a.push(o));return a._parent=n._parent,a}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=st(t)),new W(e(this._root,n),n)}function U(t){function e(n,i){var o,a,u=-1,s=n.length,c=new Array(s);if(--i)for(var l=2*i,h=l+1;++u<s;)(o=n[u])&&(r[l]=o._parent.__data__,r[h]=u,c[u]=e(o,i));else for(;++u<s;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,c[u]=a=t.apply(o,r),a._parent=o);return c._parent=n._parent,c}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=j(t)),new W(e(this._root,n),n+1)}function j(t){return function(){return this.querySelectorAll(t)}}function K(t){function e(n,i,o){var a,u,s=-1,c=n.length,l=new Array(c);if(--o)for(var h=2*o,f=h+1;++s<c;)(a=n[s])&&(r[h]=a._parent.__data__,r[f]=s,l[s]=e(a,i&&i[s],o));else for(;++s<c;)(a=n[s])&&(r[0]=a.__data__,r[1]=s,(u=t.apply(a,r))&&("__data__"in a&&(u.__data__=a.__data__),i&&(i[s]=u,delete n[s]),l[s]=u));return l._parent=n._parent,l}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=p(t)),new W(e(this._root,this._update&&this._update._root,n),n)}function W(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}function F(){return new W([document.documentElement],1)}function J(t){return new W(["string"==typeof t?document.querySelector(t):t],1)}function Q(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>ht){var i=defaultView(t);if(i.scrollX||i.scrollY){n=J(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n.node().getScreenCTM();ht=!(o.f||o.e),n.remove()}}return ht?(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 a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}function Z(t,e){arguments.length<2&&(e=a().touches);for(var n=0,r=e?e.length:0,i=new Array(r);r>n;++n)i[n]=Q(t,e[n]);return i}function tt(t,e,n){arguments.length<3&&(n=e,e=a().changedTouches);for(var r,i=0,o=e?e.length:0;o>i;++i)if((r=e[i]).identifier===n)return Q(t,r);return null}function et(t){return new W("string"==typeof t?document.querySelectorAll(t):t,1)}function nt(t,e){return arguments.length<2&&(e=a()),e.changedTouches&&(e=e.changedTouches[0]),Q(t,e)}var rt=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,it={};if(t.event$1=null,"undefined"!=typeof document){var ot=document.documentElement;"onmouseenter"in ot||(it={mouseenter:"mouseover",mouseleave:"mouseout"})}var at={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/"},ut="$";k.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}};var st=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var ct=document.documentElement;if(!ct.matches){var lt=ct.webkitMatchesSelector||ct.msMatchesSelector||ct.mozMatchesSelector||ct.oMatchesSelector;st=function(t){return function(){return lt.call(this,t)}}}}W.prototype=F.prototype={select:K,selectAll:U,filter:H,data:Y,enter:O,exit:I,order:R,sort:V,call:L,nodes:$,node:N,size:M,empty:C,each:E,attr:S,style:b,property:x,"class":m,classed:m,text:v,html:g,append:_,insert:_,remove:h,datum:l,event:n,on:n,dispatch:s};var ht="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0;t.event=t.event$1,t.mouse=nt,t.namespace=f,t.namespaces=at,t.requote=e,t.select=J,t.selectAll=et,t.selection=F,t.touch=tt,t.touches=Z});
{
"name": "d3-selection",
"version": "0.4.9",
"version": "0.4.10",
"description": "Data-driven DOM manipulation: select elements and join them to data.",

@@ -17,3 +17,3 @@ "keywords": [

},
"main": "build/selection",
"main": "build/selection.cjs",
"jsnext:main": "index",

@@ -25,10 +25,10 @@ "repository": {

"scripts": {
"pretest": "mkdir -p build && d3-bundler --format=umd --name=selection -- index.js > build/selection.js",
"pretest": "mkdir -p build && d3-bundler -x -f cjs -o build/selection.cjs.js",
"test": "faucet `find test -name '*-test.js'`",
"prepublish": "npm run test && uglifyjs build/selection.js -c -m -o build/selection.min.js && rm -f build/selection.zip && zip -j build/selection.zip -- LICENSE README.md build/selection.js build/selection.min.js"
"prepublish": "npm run test && d3-bundler -n selection -o build/selection.js && uglifyjs build/selection.js -c -m -o build/selection.min.js && rm -f build/selection.zip && zip -j build/selection.zip -- LICENSE README.md build/selection.js build/selection.min.js"
},
"devDependencies": {
"d3-bundler": "~0.3.0",
"d3-bundler": "~0.4.0",
"faucet": "0.0",
"jsdom": "3",
"jsdom": "7",
"tape": "4",

@@ -35,0 +35,0 @@ "uglify-js": "2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc