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.0 to 0.4.1

28

d3-selection.js

@@ -280,3 +280,3 @@ if (!this.Map) {

nodeByKeyValue = new Map,
keyStack = [null, null].concat(stack),
keyStack = new Array(2).concat(stack),
keyValues = new Array(nodeLength),

@@ -1032,19 +1032,19 @@ keyValue;

var index = {
mouse: mouse,
namespace: namespace,
namespaces: namespaces,
requote: requote,
select: select,
selectAll: selectAll,
selection: Selection,
touch: src_touch,
touches: src_touches
var index_js = {
get mouse () { return mouse; },
get namespace () { return namespace; },
get namespaces () { return namespaces; },
get requote () { return requote; },
get select () { return select; },
get selectAll () { return selectAll; },
get selection () { return Selection; },
get touch () { return src_touch; },
get touches () { return src_touches; }
};
var d3 = global.d3;
if (d3) for (var field in index) d3[field] = index[field];
else global.d3 = d3 = index;
var object = global;
object = object.d3 || (object.d3 = {});
for (var name in index_js) object[name] = index_js[name];
if (typeof define === "function" && define.amd) define(d3);
else if (typeof module === "object" && module.exports) module.exports = d3;
})(typeof global === "undefined" ? this : global);

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

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

@@ -11,12 +11,12 @@ import mouse from "./src/mouse";

export default {
mouse: mouse,
namespace: namespace,
namespaces: namespaces,
requote: requote,
select: select,
selectAll: selectAll,
selection: Selection,
touch: touch,
touches: touches
export {
mouse,
namespace,
namespaces,
requote,
select,
selectAll,
Selection as selection,
touch,
touches
};
{
"name": "d3-selection",
"version": "0.4.0",
"version": "0.4.1",
"description": "Data-driven DOM manipulation.",

@@ -11,3 +11,3 @@ "main": "d3-selection",

"devDependencies": {
"d3-bundler": "0.2",
"d3-bundler": "~0.2.1",
"faucet": "0.0",

@@ -14,0 +14,0 @@ "jsdom": "3",

# d3-selection
This EXPERIMENTAL module implements the core concept of D3: manipulating the DOM by selecting elements and joining to data.
This module implements the core concept of D3: manipulating the DOM by selecting elements and joining to data. This code is currently EXPERIMENTAL and represents the in-development D3 4.0 API. The 4.0 API is largely backwards-compatible, but differs from 3.x in several ways:
API changes from D3 3.x:
* The implementation is now organized into ES6 modules, rather than the ad hoc concatentation used previously. A [UMD](https://github.com/umdjs/umd) build is provided using [Esperanto](http://esperantojs.org/), but feel free to roll your own.
* The implementation is now organized into ES6 modules, rather than the ad hoc [SMASH](https://github.com/mbostock/smash) bundling used previously. A [UMD](https://github.com/umdjs/umd) build is provided for your convenience using [Esperanto](http://esperantojs.org/), but you are free to define your own build process (e.g., [Browserify](http://browserify.org/) or [Webpack](https://webpack.github.io/)). See [#2220](https://github.com/mbostock/d3/issues/2220).
* The Selection class now extends Object, rather than Array. This obviates the need for [prototype injection](http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/#wrappers_prototype_chain_injection) and [direct property injection](http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/#wrappers_direct_property_injection). Selections are now hierarchical, rather than having fixed two-level nesting. Accessor functions such as those accepted by selection.attr and selection.style can now refer to [parent data](http://bl.ocks.org/mbostock/7a8a2de2b99d391add4b) and indexes if desired.
* The Selection class now extends Object, not Array, obviating the need for [prototype injection](http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/#wrappers_prototype_chain_injection) (and [direct property injection](http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/#wrappers_direct_property_injection) on runtimes that do not support `__proto__`). See [#2191](https://github.com/mbostock/d3/issues/2191).
* The selection.data method (when called with arguments) now modifies the current selection to be the update selection, rather than returning a new selection. The enter and exit selections are now empty prior to a data-join, rather than non-existant. The selection.data method (when called *without* arguments) now returns an array of data for *all* selected elements, not just the first group.
* Selections are now truly hierarchical! Rather than always being a nested array, selections have arbitrary depth. Accessor functions such as those accepted by selection.attr and selection.style can now refer to [parent data](http://bl.ocks.org/mbostock/7a8a2de2b99d391add4b) (and indices) if desired.
* Enter selections no longer have a special subclass, and thus support all selection methods.
* The selection.data method, when called with arguments, now modifies the current selection to be the update selection, rather than returning a new selection. Likewise, the enter and exit selections are lazily constructed and modified in-place. The selection.enter and selection.exit methods now return empty selections if the selection has not yet been bound to data. (Previously, attempting to access these methods before binding to data would throw an error.) See [#2402](https://github.com/mbostock/d3/issues/2402).
* A new selection.nodes method returns an array of all selected elements.
* The selection.data method, when called *without* arguments, now returns an array of data for all elements in the selection, not just the first group.
* The selection.append method now takes an optional *before* selector and replaces selection.insert. The selection.insert method is now deprecated. The selection.append method now inserts entering elements in data order by default when joining by key. (This assumes that new data is in the same order as old data; if not, use selection.order.) The selection.append method now moves, rather than copies, entering elements to the update selection.
* Similarly, a new selection selection.nodes method returns an array of all elements in the selection (flattening the underlying hierarchy).
* The selection.classed method has been renamed selection.class. The old name is deprecated but preserved for backwards-compatibility.
* The selection.insert method has been renamed (and replaces) selection.append. Thus, the enter.append method now inserts elements in data order by default when joining by key! (This assumes that new data is in the same order as old data; if not, use selection.order after.)
* The enter.append method now moves (rather than copies) elements to the update selection. (In practice, you are unlikely to notice the difference, as enter selections are typically discarded upon append. But this makes more sense now that enter selections are persistent.)
* Enter selections no longer have a special subclass. Instead, enter nodes function as virtual placeholders, providing appendChild and insertBefore methods for use with selection.append.
* The selection.classed method has been renamed selection.class. (Note: `class` is a reserved word in ES6, but ES5 and later allow reserved words as identifier names.) The old name is deprecated but preserved for backwards-compatibility.
* The selection.on method has been renamed selection.event. The old name is deprecated but preserved for backwards-compatibility.
* A new selection.dispatch method dispatches a [custom event](https://dom.spec.whatwg.org/#interface-customevent) of the specified type to all selected elements. It’s like trigger in jQuery.
* A new selection.dispatch method dispatches a [custom event](https://dom.spec.whatwg.org/#interface-customevent) of the specified type to all selected elements. Think of it like jQuery’s trigger.
* [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.
* The d3.ns.prefix namespace map has been renamed to d3.namespaces and is now a Map rather than an object.
* Removed support for Sizzle. It’s time.
* The d3.ns.qualify method has been renamed to d3.namespace.
* Sizzle is no longer supported. It’s time.

@@ -100,3 +100,3 @@ // The value may either be an array or a function that returns an array.

nodeByKeyValue = new Map,
keyStack = [null, null].concat(stack),
keyStack = new Array(2).concat(stack),
keyValues = new Array(nodeLength),

@@ -103,0 +103,0 @@ keyValue;

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