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.6.8 to 0.6.9

2

build/bundle.js

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

var version = "0.6.8"; export * from "../index"; export {version};
var version = "0.6.9"; export * from "../index"; export {version};

@@ -67,10 +67,2 @@ (function (global, factory) {

var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
function requote(string) {
return string.replace(requoteRe, "\\$&");
}
function noop() {}
var filterEvents = {};

@@ -87,2 +79,12 @@

function filterContextListener(listener, index, group) {
listener = contextListener(listener, index, group);
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener.call(this, event);
}
};
}
function contextListener(listener, index, group) {

@@ -100,59 +102,64 @@ return function(event1) {

function filterListener(listener) {
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener(event);
}
};
function parseTypenames(typenames) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
return {type: t, name: name};
});
}
function onRemove(key, type) {
function onRemove(typename) {
return function() {
var l = this[key];
if (l) {
this.removeEventListener(type, l, l._capture);
delete this[key];
var on = this.__on;
if (!on) return;
for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.capture);
} else {
on[++i] = o;
}
}
if (++i) on.length = i;
else delete this.__on;
};
}
function onRemoveAll(dotname) {
var re = new RegExp("^__on([^.]+)" + requote(dotname) + "$");
return function() {
for (var key in this) {
var match = key.match(re);
if (match) {
var l = this[key];
this.removeEventListener(match[1], l, l._capture);
delete this[key];
function onAdd(typename, value, capture) {
var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
return function(d, i, group) {
var on = this.__on, o, listener = wrap(value, i, group);
if (on) for (var j = 0, m = on.length; j < m; ++j) {
if ((o = on[j]).type === typename.type && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.capture);
this.addEventListener(o.type, o.listener = listener, o.capture = capture);
o.value = value;
return;
}
}
this.addEventListener(typename.type, listener, capture);
o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
if (!on) this.__on = [o];
else on.push(o);
};
}
function onAdd(filter, key, type, listener, capture) {
return function(d, i, group) {
var value = this[key];
if (value) this.removeEventListener(type, value, value._capture);
value = contextListener(listener, i, group);
if (filter) value = filterListener(value);
value._listener = listener;
this.addEventListener(type, this[key] = value, value._capture = capture);
};
}
function selection_on(typename, value, capture) {
var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
function selection_on(type, listener, capture) {
var value,
name = type + "",
key = "__on" + name,
filter;
if (arguments.length < 2) {
var on = this.node().__on;
if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
for (i = 0, o = on[j]; i < n; ++i) {
if ((t = typenames[i]).type === o.type && t.name === o.name) {
return o.value;
}
}
}
return;
}
if (arguments.length < 2) return (value = this.node()[key]) && value._listener;
if ((value = name.indexOf(".")) > 0) name = name.slice(0, value);
if (filter = filterEvents.hasOwnProperty(name)) name = filterEvents[name];
return this.each(listener
? (value ? onAdd(filter, key, name, listener, capture == null ? false : capture) : noop) // Attempt to add untyped listener is ignored.
: (value ? onRemove(key, name) : onRemoveAll(name)));
on = value ? onAdd : onRemove;
if (capture == null) capture = false;
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
return this;
}

@@ -943,3 +950,3 @@

var version = "0.6.8";
var version = "0.6.9";

@@ -946,0 +953,0 @@ exports.version = version;

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_selection={})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),zt.hasOwnProperty(n)?{space:zt[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e&&e!==n.documentElement.namespaceURI?n.createElementNS(e,t):n.createElement(t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function u(t){return t.replace($t,"\\$&")}function o(){}function s(n,e,r){return function(i){var u=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=u}}}function a(t){return function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t(n)}}function c(t,n){return function(){var e=this[t];e&&(this.removeEventListener(n,e,e._capture),delete this[t])}}function l(t){var n=new RegExp("^__on([^.]+)"+u(t)+"$");return function(){for(var t in this){var e=t.match(n);if(e){var r=this[t];this.removeEventListener(e[1],r,r._capture),delete this[t]}}}}function h(t,n,e,r,i){return function(u,o,c){var l=this[n];l&&this.removeEventListener(e,l,l._capture),l=s(r,o,c),t&&(l=a(l)),l._listener=r,this.addEventListener(e,this[n]=l,l._capture=i)}}function f(t,n,e){var r,i,u=t+"",s="__on"+u;return arguments.length<2?(r=this.node()[s])&&r._listener:((r=u.indexOf("."))>0&&(u=u.slice(0,r)),(i=jt.hasOwnProperty(u))&&(u=jt[u]),this.each(n?r?h(i,s,u,n,null==e?!1:e):o:r?c(s,u):l(u)))}function p(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function _(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function m(t){return function(){return this.querySelector(t)}}function d(t){"function"!=typeof t&&(t=m(t));for(var n=this._groups,e=this._update,r=n.length,i=new Array(r),u=0;r>u;++u)for(var o,s,a=n[u],c=a.length,l=i[u]=new Array(c),h=0;c>h;++h)(o=a[h])&&(s=t.call(o,o.__data__,h,a))&&("__data__"in o&&(s.__data__=o.__data__),e&&(e._groups[u][h]=s),l[h]=s);return new Pt(i,this._parents)}function g(t){return function(){return this.querySelectorAll(t)}}function v(t){"function"!=typeof t&&(t=g(t));for(var n=this._groups,e=n.length,r=[],i=[],u=0;e>u;++u)for(var o,s=n[u],a=s.length,c=0;a>c;++c)(o=s[c])&&(r.push(t.call(o,o.__data__,c,s)),i.push(o));return new Pt(r,i)}function y(t){"function"!=typeof t&&(t=Yt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var u,o=n[i],s=o.length,a=r[i]=[],c=0;s>c;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&a.push(u);return new Pt(r,this._parents)}function w(t){for(var n=t._groups,e=0,r=n.length;r>e;++e)if(!Array.isArray(i=n[e]))for(var i,u=i.length,o=n[e]=new Array(u),s=0;u>s;++s)o[s]=i[s];return n}function x(t){return function(){return t}}function A(t,n,e,r,i){var u,o=0,s=n.length,a=i.length,c=Math.min(s,a);for(e.length=0,e.length=a,r.length=0,r.length=s;c>o;++o)(u=n[o])?u.__data__=i[o]:e[o]=new E(t,i[o]);for(;a>o;++o)e[o]=new E(t,i[o]);for(;s>o;++o)(u=n[o])&&(r[o]=n[o]);n.length=a}function S(t,n,e,r,i,u){var o,s,a,c=i.length,l=n.length,h={},f=new Array(l);for(e.length=0,e.length=c,r.length=0,r.length=l,o=0;l>o;++o)(s=n[o])&&(f[o]=a=Gt+u.call(s,s.__data__,o,n),h[a]?r[o]=s:h[a]=s);for(n.length=0,n.length=c,o=0;c>o;++o)a=Gt+u.call(t,i[o],o,i),(s=h[a])?s!==!0&&(n[o]=s,s.__data__=i[o]):e[o]=new E(t,i[o]),h[a]=!0;for(o=0;l>o;++o)(s=h[f[o]])!==!0&&(r[o]=s)}function b(t,n){if(!t){var e=new Array(this.size()),r=-1;return this.each(function(t){e[++r]=t}),e}var i=n?S:A,u=this._parents,o=w(this),s=(this._enter=this.enter())._groups,a=(this._exit=this.exit())._groups;"function"!=typeof t&&(t=x(t));for(var c=o.length,l=0;c>l;++l){var h=o[l],f=u[l];i(f,h,s[l],a[l],t.call(f,f&&f.__data__,l,u),n);for(var p,_,m=h.length,d=0,g=0;m>d;++d)if(p=s[l][d]){for(d>=g&&(g=d+1);!(_=h[g])&&++g<m;);p._next=_||null}}return this}function E(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function C(t){return new Array(t.length)}function N(){var t=this._enter;return t?(this._enter=null,t):(t=new Pt(this._groups.map(C),this._parents),t._update=this,t)}function M(){var t=this._exit;return t?(this._exit=null,t):new Pt(this._groups.map(C),this._parents)}function T(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],u=i.length-1,o=i[u];--u>=0;)(r=i[u])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this}function L(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=P);for(var e=w(this),r=0,i=e.length;i>r;++r)e[r].sort(n);return this.order()}function P(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function q(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function B(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function D(){for(var t=this._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,u=r.length;u>i;++i){var o=r[i];if(o)return o}return null}function O(){var t=0;return this.each(function(){++t}),t}function R(){return!this.node()}function V(t){for(var n=this._groups,e=0,r=n.length;r>e;++e)for(var i,u=n[e],o=0,s=u.length;s>o;++o)(i=u[o])&&t.call(i,i.__data__,o,u);return this}function X(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function H(t,n){return function(){this.setAttribute(t,n)}}function I(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function U(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function Y(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function $(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?z:X:"function"==typeof e?r.local?Y:U:r.local?I:H)(r,e))}function j(t){return function(){this.style.removeProperty(t)}}function k(t,n,e){return function(){this.style.setProperty(t,n,e)}}function G(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function K(t,n,e){var r;return arguments.length>1?this.each((null==n?j:"function"==typeof n?G:k)(t,n,null==e?"":e)):_(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function W(t){return function(){delete this[t]}}function F(t,n){return function(){this[t]=n}}function J(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Q(t,n){return arguments.length>1?this.each((null==n?W:"function"==typeof n?J:F)(t,n)):this.node()[t]}function Z(t){return t.trim().split(/^|\s+/)}function tt(t){return t.classList||new nt(t)}function nt(t){this._node=t,this._names=Z(t.getAttribute("class")||"")}function et(t,n){for(var e=tt(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function rt(t,n){for(var e=tt(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function it(t){return function(){et(this,t)}}function ut(t){return function(){rt(this,t)}}function ot(t,n){return function(){(n.apply(this,arguments)?et:rt)(this,t)}}function st(t,n){var e=Z(t+"");if(arguments.length<2){for(var r=tt(this.node()),i=-1,u=e.length;++i<u;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?ot:n?it:ut)(e,n))}function at(){this.textContent=""}function ct(t){return function(){this.textContent=t}}function lt(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function ht(t){return arguments.length?this.each(null==t?at:("function"==typeof t?lt:ct)(t)):this.node().textContent}function ft(){this.innerHTML=""}function pt(t){return function(){this.innerHTML=t}}function _t(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function mt(t){return arguments.length?this.each(null==t?ft:("function"==typeof t?_t:pt)(t)):this.node().innerHTML}function dt(){this.parentNode.appendChild(this)}function gt(){return this.each(dt)}function vt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yt(){return this.each(vt)}function wt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function xt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function At(){return null}function St(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?wt(e):xt(e,null==n?At:"function"==typeof n?n:m(n)))}function bt(){var t=this.parentNode;t&&t.removeChild(this)}function Et(){return this.each(bt)}function Ct(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Nt(t,n,e){var r=_(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Mt(t,n){return function(){return Nt(this,t,n)}}function Tt(t,n){return function(){return Nt(this,t,n.apply(this,arguments))}}function Lt(t,n){return this.each(("function"==typeof n?Tt:Mt)(t,n))}function Pt(t,n){this._groups=t,this._parents=n}function qt(){return new Pt([[document.documentElement]],Kt)}function Bt(t){return"string"==typeof t?new Pt([[document.querySelector(t)]],[document.documentElement]):new Pt([[t]],Kt)}function Dt(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Wt){var i=_(t);if(i.scrollX||i.scrollY){e=Bt(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e.node().getScreenCTM();Wt=!(u.f||u.e),e.remove()}}return Wt?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var o=t.getBoundingClientRect();return[n.clientX-o.left-t.clientLeft,n.clientY-o.top-t.clientTop]}function Ot(t,n){return null==n&&(n=p()),n.changedTouches&&(n=n.changedTouches[0]),Dt(t,n)}function Rt(t){return"string"==typeof t?new Pt([document.querySelectorAll(t)],[document.documentElement]):new Pt([t],Kt)}function Vt(t,n,e){arguments.length<3&&(e=n,n=p().changedTouches);for(var r,i=0,u=n?n.length:0;u>i;++i)if((r=n[i]).identifier===e)return Dt(t,r);return null}function Xt(t,n){null==n&&(n=p().touches);for(var e=0,r=n?n.length:0,i=new Array(r);r>e;++e)i[e]=Dt(t,n[e]);return i}var zt={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/"},Ht=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var It=document.documentElement;if(!It.matches){var Ut=It.webkitMatchesSelector||It.msMatchesSelector||It.mozMatchesSelector||It.oMatchesSelector;Ht=function(t){return function(){return Ut.call(this,t)}}}}var Yt=Ht,$t=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,jt={};if(t.event=null,"undefined"!=typeof document){var kt=document.documentElement;"onmouseenter"in kt||(jt={mouseenter:"mouseover",mouseleave:"mouseout"})}var Gt="$";E.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},nt.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Kt=[null];Pt.prototype=qt.prototype={select:d,selectAll:v,filter:y,data:b,enter:N,exit:M,order:T,sort:L,call:q,nodes:B,node:D,size:O,empty:R,each:V,attr:$,style:K,property:Q,classed:st,text:ht,html:mt,raise:gt,lower:yt,append:St,remove:Et,datum:Ct,on:f,dispatch:Lt};var Wt="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,Ft="0.6.8";t.version=Ft,t.creator=i,t.matcher=Yt,t.mouse=Ot,t.namespace=n,t.namespaces=zt,t.select=Bt,t.selectAll=Rt,t.selection=qt,t.selector=m,t.selectorAll=g,t.touch=Vt,t.touches=Xt,t.window=_});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_selection={})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Rt.hasOwnProperty(n)?{space:Rt[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e&&e!==n.documentElement.namespaceURI?n.createElementNS(e,t):n.createElement(t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function u(t,n,e){return t=o(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function o(n,e,r){return function(i){var u=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=u}}}function s(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function a(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,u=n.length;u>r;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function c(t,n,e){var r=Ut.hasOwnProperty(t.type)?u:o;return function(i,u,o){var s,a=this.__on,c=r(n,u,o);if(a)for(var l=0,f=a.length;f>l;++l)if((s=a[l]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=c,s.capture=e),void(s.value=n);this.addEventListener(t.type,c,e),s={type:t.type,name:t.name,value:n,listener:c,capture:e},a?a.push(s):this.__on=[s]}}function l(t,n,e){var r,i,u=s(t+""),o=u.length;{if(!(arguments.length<2)){for(l=n?c:a,null==e&&(e=!1),r=0;o>r;++r)this.each(l(u[r],n,e));return this}var l=this.node().__on;if(l)for(var f,h=0,p=l.length;p>h;++h)for(r=0,f=l[h];o>r;++r)if((i=u[r]).type===f.type&&i.name===f.name)return f.value}}function f(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function h(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function p(t){return function(){return this.querySelector(t)}}function m(t){"function"!=typeof t&&(t=p(t));for(var n=this._groups,e=this._update,r=n.length,i=new Array(r),u=0;r>u;++u)for(var o,s,a=n[u],c=a.length,l=i[u]=new Array(c),f=0;c>f;++f)(o=a[f])&&(s=t.call(o,o.__data__,f,a))&&("__data__"in o&&(s.__data__=o.__data__),e&&(e._groups[u][f]=s),l[f]=s);return new Tt(i,this._parents)}function _(t){return function(){return this.querySelectorAll(t)}}function d(t){"function"!=typeof t&&(t=_(t));for(var n=this._groups,e=n.length,r=[],i=[],u=0;e>u;++u)for(var o,s=n[u],a=s.length,c=0;a>c;++c)(o=s[c])&&(r.push(t.call(o,o.__data__,c,s)),i.push(o));return new Tt(r,i)}function g(t){"function"!=typeof t&&(t=It(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var u,o=n[i],s=o.length,a=r[i]=[],c=0;s>c;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&a.push(u);return new Tt(r,this._parents)}function v(t){for(var n=t._groups,e=0,r=n.length;r>e;++e)if(!Array.isArray(i=n[e]))for(var i,u=i.length,o=n[e]=new Array(u),s=0;u>s;++s)o[s]=i[s];return n}function y(t){return function(){return t}}function w(t,n,e,r,i){var u,o=0,s=n.length,a=i.length,c=Math.min(s,a);for(e.length=0,e.length=a,r.length=0,r.length=s;c>o;++o)(u=n[o])?u.__data__=i[o]:e[o]=new S(t,i[o]);for(;a>o;++o)e[o]=new S(t,i[o]);for(;s>o;++o)(u=n[o])&&(r[o]=n[o]);n.length=a}function x(t,n,e,r,i,u){var o,s,a,c=i.length,l=n.length,f={},h=new Array(l);for(e.length=0,e.length=c,r.length=0,r.length=l,o=0;l>o;++o)(s=n[o])&&(h[o]=a=jt+u.call(s,s.__data__,o,n),f[a]?r[o]=s:f[a]=s);for(n.length=0,n.length=c,o=0;c>o;++o)a=jt+u.call(t,i[o],o,i),(s=f[a])?s!==!0&&(n[o]=s,s.__data__=i[o]):e[o]=new S(t,i[o]),f[a]=!0;for(o=0;l>o;++o)(s=f[h[o]])!==!0&&(r[o]=s)}function A(t,n){if(!t){var e=new Array(this.size()),r=-1;return this.each(function(t){e[++r]=t}),e}var i=n?x:w,u=this._parents,o=v(this),s=(this._enter=this.enter())._groups,a=(this._exit=this.exit())._groups;"function"!=typeof t&&(t=y(t));for(var c=o.length,l=0;c>l;++l){var f=o[l],h=u[l];i(h,f,s[l],a[l],t.call(h,h&&h.__data__,l,u),n);for(var p,m,_=f.length,d=0,g=0;_>d;++d)if(p=s[l][d]){for(d>=g&&(g=d+1);!(m=f[g])&&++g<_;);p._next=m||null}}return this}function S(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function b(t){return new Array(t.length)}function E(){var t=this._enter;return t?(this._enter=null,t):(t=new Tt(this._groups.map(b),this._parents),t._update=this,t)}function C(){var t=this._exit;return t?(this._exit=null,t):new Tt(this._groups.map(b),this._parents)}function N(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],u=i.length-1,o=i[u];--u>=0;)(r=i[u])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this}function M(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=T);for(var e=v(this),r=0,i=e.length;i>r;++r)e[r].sort(n);return this.order()}function T(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function L(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function P(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function q(){for(var t=this._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,u=r.length;u>i;++i){var o=r[i];if(o)return o}return null}function B(){var t=0;return this.each(function(){++t}),t}function D(){return!this.node()}function O(t){for(var n=this._groups,e=0,r=n.length;r>e;++e)for(var i,u=n[e],o=0,s=u.length;s>o;++o)(i=u[o])&&t.call(i,i.__data__,o,u);return this}function V(t){return function(){this.removeAttribute(t)}}function R(t){return function(){this.removeAttributeNS(t.space,t.local)}}function X(t,n){return function(){this.setAttribute(t,n)}}function z(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function H(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function U(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?R:V:"function"==typeof e?r.local?I:H:r.local?z:X)(r,e))}function Y(t){return function(){this.style.removeProperty(t)}}function j(t,n,e){return function(){this.style.setProperty(t,n,e)}}function k(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function G(t,n,e){var r;return arguments.length>1?this.each((null==n?Y:"function"==typeof n?k:j)(t,n,null==e?"":e)):h(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function K(t){return function(){delete this[t]}}function W(t,n){return function(){this[t]=n}}function $(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function F(t,n){return arguments.length>1?this.each((null==n?K:"function"==typeof n?$:W)(t,n)):this.node()[t]}function J(t){return t.trim().split(/^|\s+/)}function Q(t){return t.classList||new Z(t)}function Z(t){this._node=t,this._names=J(t.getAttribute("class")||"")}function tt(t,n){for(var e=Q(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function nt(t,n){for(var e=Q(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function et(t){return function(){tt(this,t)}}function rt(t){return function(){nt(this,t)}}function it(t,n){return function(){(n.apply(this,arguments)?tt:nt)(this,t)}}function ut(t,n){var e=J(t+"");if(arguments.length<2){for(var r=Q(this.node()),i=-1,u=e.length;++i<u;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?it:n?et:rt)(e,n))}function ot(){this.textContent=""}function st(t){return function(){this.textContent=t}}function at(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function ct(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:st)(t)):this.node().textContent}function lt(){this.innerHTML=""}function ft(t){return function(){this.innerHTML=t}}function ht(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function pt(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ht:ft)(t)):this.node().innerHTML}function mt(){this.parentNode.appendChild(this)}function _t(){return this.each(mt)}function dt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gt(){return this.each(dt)}function vt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function yt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function wt(){return null}function xt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?vt(e):yt(e,null==n?wt:"function"==typeof n?n:p(n)))}function At(){var t=this.parentNode;t&&t.removeChild(this)}function St(){return this.each(At)}function bt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Et(t,n,e){var r=h(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Ct(t,n){return function(){return Et(this,t,n)}}function Nt(t,n){return function(){return Et(this,t,n.apply(this,arguments))}}function Mt(t,n){return this.each(("function"==typeof n?Nt:Ct)(t,n))}function Tt(t,n){this._groups=t,this._parents=n}function Lt(){return new Tt([[document.documentElement]],kt)}function Pt(t){return"string"==typeof t?new Tt([[document.querySelector(t)]],[document.documentElement]):new Tt([[t]],kt)}function qt(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Gt){var i=h(t);if(i.scrollX||i.scrollY){e=Pt(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e.node().getScreenCTM();Gt=!(u.f||u.e),e.remove()}}return Gt?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var o=t.getBoundingClientRect();return[n.clientX-o.left-t.clientLeft,n.clientY-o.top-t.clientTop]}function Bt(t,n){return null==n&&(n=f()),n.changedTouches&&(n=n.changedTouches[0]),qt(t,n)}function Dt(t){return"string"==typeof t?new Tt([document.querySelectorAll(t)],[document.documentElement]):new Tt([t],kt)}function Ot(t,n,e){arguments.length<3&&(e=n,n=f().changedTouches);for(var r,i=0,u=n?n.length:0;u>i;++i)if((r=n[i]).identifier===e)return qt(t,r);return null}function Vt(t,n){null==n&&(n=f().touches);for(var e=0,r=n?n.length:0,i=new Array(r);r>e;++e)i[e]=qt(t,n[e]);return i}var Rt={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/"},Xt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var zt=document.documentElement;if(!zt.matches){var Ht=zt.webkitMatchesSelector||zt.msMatchesSelector||zt.mozMatchesSelector||zt.oMatchesSelector;Xt=function(t){return function(){return Ht.call(this,t)}}}}var It=Xt,Ut={};if(t.event=null,"undefined"!=typeof document){var Yt=document.documentElement;"onmouseenter"in Yt||(Ut={mouseenter:"mouseover",mouseleave:"mouseout"})}var jt="$";S.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Z.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var kt=[null];Tt.prototype=Lt.prototype={select:m,selectAll:d,filter:g,data:A,enter:E,exit:C,order:N,sort:M,call:L,nodes:P,node:q,size:B,empty:D,each:O,attr:U,style:G,property:F,classed:ut,text:ct,html:pt,raise:_t,lower:gt,append:xt,remove:St,datum:bt,on:l,dispatch:Mt};var Gt="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,Kt="0.6.9";t.version=Kt,t.creator=i,t.matcher=It,t.mouse=Bt,t.namespace=n,t.namespaces=Rt,t.select=Pt,t.selectAll=Dt,t.selection=Lt,t.selector=p,t.selectorAll=_,t.touch=Ot,t.touches=Vt,t.window=h});
{
"name": "d3-selection",
"version": "0.6.8",
"version": "0.6.9",
"description": "Data-driven DOM manipulation: select elements and join them to data.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -189,2 +189,6 @@ # d3-selection

<a name="window" href="#window">#</a> d3.<b>window</b>(<i>node</i>)
Returns the owner window for the specified *node*. If *node* is a node, returns the owner document’s default view; if *node* is a document, returns its default view; otherwise returns the *node*.
### Modifying Elements

@@ -338,6 +342,2 @@

<a name="window" href="#window">#</a> d3.<b>window</b>(<i>node</i>)
Returns the owner window for the specified *node*. If *node* is a node, returns the owner document’s default view; if *node* is a document, returns its default view; otherwise returns the *node*.
### Joining Data

@@ -509,11 +509,13 @@

<a name="selection_on" href="#selection_on">#</a> <i>selection</i>.<b>on</b>(<i>type</i>[, <i>listener</i>[, <i>capture</i>]])
<a name="selection_on" href="#selection_on">#</a> <i>selection</i>.<b>on</b>(<i>typenames</i>[, <i>listener</i>[, <i>capture</i>]])
Adds or removes a *listener* to each selected element for the specified event *type*. The *type* is a string event type name, such as `click`, `mouseover`, or `submit`; any [DOM event type](https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events) supported by your browser may be used. The *listener* is invoked for each selected element, being passed the current datum *d* and index *i*, with the `this` context as the current DOM element. Listeners always see the latest datum for their element, but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener. To access the current event within a listener, use [d3.event](#event).
Adds or removes a *listener* to each selected element for the specified event *typenames*. The *typenames* is a string event type, such as `click`, `mouseover`, or `submit`; any [DOM event type](https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events) supported by your browser may be used. The type may be optionally followed by a period (`.`) and a name; the optional name allows multiple callbacks to be registered to receive events of the same type, such as `click.foo` and `click.bar`. To specify multiple typenames, separate typenames with spaces, such as `input change` or `click.foo click.bar`.
If an event listener was previously registered for the same *type* on a selected element, the old listener is removed before the new listener is added. To register multiple listeners for a given type, the type may be followed by an optional name, such as `click.foo` and `click.bar`. To remove a listener, pass null as the *listener*. To remove all listeners for a given name, pass null as the *listener* and `.foo` as the *type*, where *foo* is the name.
When an specified event is dispatched on a selected node, the specified *listener* will be invoked for each selected element, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. Listeners always see the latest datum for their element, but the index is a property of the selection and is fixed when the listener is assigned; to update the index, re-assign the listener. To access the current event within a listener, use [d3.event](#event).
If an event listener was previously registered for the same *typename* on a selected element, the old listener is removed before the new listener is added. To remove a listener, pass null as the *listener*. To remove all listeners for a given name, pass null as the *listener* and `.foo` as the *typename*, where `foo` is the name; to remove all listeners with no name, specify `.` as the *typename*.
An optional *capture* flag may be specified which corresponds to the W3C [useCapture flag](http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration): “After initiating capture, all events of the specified type will be dispatched to the registered EventListener before being dispatched to any EventTargets beneath them in the tree. Events which are bubbling upward through the tree will not trigger an EventListener designated to use capture.”
If a *listener* is not specified, returns the currently-assigned listener for the specified event *type* on the first (non-null) selected element, if any.
If a *listener* is not specified, returns the currently-assigned listener for the specified event *typename* on the first (non-null) selected element, if any. If multiple typenames are specified, the first matching listener is returned.

@@ -520,0 +522,0 @@ <a name="selection_dispatch" href="#selection_dispatch">#</a> <i>selection</i>.<b>dispatch</b>(<i>type</i>[, <i>parameters</i>])

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

import requote from "../requote";
import noop from "../noop";
var filterEvents = {};

@@ -15,2 +12,12 @@

function filterContextListener(listener, index, group) {
listener = contextListener(listener, index, group);
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener.call(this, event);
}
};
}
function contextListener(listener, index, group) {

@@ -28,59 +35,64 @@ return function(event1) {

function filterListener(listener) {
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener(event);
}
};
function parseTypenames(typenames) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
return {type: t, name: name};
});
}
function onRemove(key, type) {
function onRemove(typename) {
return function() {
var l = this[key];
if (l) {
this.removeEventListener(type, l, l._capture);
delete this[key];
var on = this.__on;
if (!on) return;
for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.capture);
} else {
on[++i] = o;
}
}
if (++i) on.length = i;
else delete this.__on;
};
}
function onRemoveAll(dotname) {
var re = new RegExp("^__on([^.]+)" + requote(dotname) + "$");
return function() {
for (var key in this) {
var match = key.match(re);
if (match) {
var l = this[key];
this.removeEventListener(match[1], l, l._capture);
delete this[key];
function onAdd(typename, value, capture) {
var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
return function(d, i, group) {
var on = this.__on, o, listener = wrap(value, i, group);
if (on) for (var j = 0, m = on.length; j < m; ++j) {
if ((o = on[j]).type === typename.type && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.capture);
this.addEventListener(o.type, o.listener = listener, o.capture = capture);
o.value = value;
return;
}
}
this.addEventListener(typename.type, listener, capture);
o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
if (!on) this.__on = [o];
else on.push(o);
};
}
function onAdd(filter, key, type, listener, capture) {
return function(d, i, group) {
var value = this[key];
if (value) this.removeEventListener(type, value, value._capture);
value = contextListener(listener, i, group);
if (filter) value = filterListener(value);
value._listener = listener;
this.addEventListener(type, this[key] = value, value._capture = capture);
};
}
export default function(typename, value, capture) {
var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
export default function(type, listener, capture) {
var value,
name = type + "",
key = "__on" + name,
filter;
if (arguments.length < 2) {
var on = this.node().__on;
if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
for (i = 0, o = on[j]; i < n; ++i) {
if ((t = typenames[i]).type === o.type && t.name === o.name) {
return o.value;
}
}
}
return;
}
if (arguments.length < 2) return (value = this.node()[key]) && value._listener;
if ((value = name.indexOf(".")) > 0) name = name.slice(0, value);
if (filter = filterEvents.hasOwnProperty(name)) name = filterEvents[name];
return this.each(listener
? (value ? onAdd(filter, key, name, listener, capture == null ? false : capture) : noop) // Attempt to add untyped listener is ignored.
: (value ? onRemove(key, name) : onRemoveAll(name)));
on = value ? onAdd : onRemove;
if (capture == null) capture = false;
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
return this;
}
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