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.3.0 to 0.4.0

16

d3-selection.js

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

"use strict";
var sourceEvent = function() {

@@ -73,8 +74,2 @@ var event = global.d3.event, source;

var selectorAllOf = function(selector) {
return function() {
return this.querySelectorAll(selector);
};
};
var selection_selectAll = function(selector) {

@@ -123,2 +118,8 @@ var depth = this._depth,

function selectorAllOf(selector) {
return function() {
return this.querySelectorAll(selector);
};
}
var selection_filter = function(filter) {

@@ -1050,3 +1051,2 @@ var depth = this._depth,

else if (typeof module === "object" && module.exports) module.exports = d3;
})(this);
})(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,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function n(t){return function(){return t}}function r(t,e){var n,i=-1,o=t.length;if(--e)for(;++i<o;)(n=t[i])&&(t[i]=r(n,e));else if(!Array.isArray(t)){for(var a=new Array(o);++i<o;)a[i]=t[i];a._parent=t._parent,t=a}return t}function i(t,e){var n,r=-1,o=t.length,a=new Array(o);if(--e)for(;++r<o;)(n=t[r])&&(a[r]=i(n,e));return a._parent=t._parent,a}function o(t,e){var n,r,i=t.length;if(--e)for(;--i>=0;)(n=t[i])&&o(n,e);else for(r=t[--i];--i>=0;)(n=t[i])&&(r&&r!==n.nextSibling&&r.parentNode.insertBefore(n,r),r=n)}function a(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function u(t,e){var n,r=-1,i=t.length;if(--e){for(;++r<i;)if((n=t[r])&&(n=u(n,e)))return n}else for(;++r<i;)if(n=t[r])return n}function s(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=new RegExp("(?:^|\\s+)"+U(t)+"(?:\\s+|$)","g"));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",c(i+" "+t))):n.setAttribute("class",c(i.replace(e," ")))}}function c(t){return t.trim().replace(/\s+/g," ")}function l(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 h(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 f(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function p(){}function _(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 d(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}var g=function(){for(var e,n=t.d3.event;e=n.sourceEvent;)n=e;return n},m=function(t){return function(){return this.querySelector(t)}},v=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 d(e(this._root,this._update&&this._update._root,n),n)},y=function(t){return function(){return this.querySelectorAll(t)}},w=function(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=y(t)),new d(e(this._root,n),n+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 d(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,r){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,n,r,i){var o,a=0,u=t.length,s=i.length,c=Math.min(u,s);for(n.length=0,n.length=s,r.length=0,r.length=u;c>a;++a)(o=t[a])?o.__data__=i[a]:n[a]=new e(t._parent,i[a]);for(;s>a;++a)n[a]=new e(t._parent,i[a]);for(;u>a;++a)(o=t[a])&&(r[a]=t[a]);t.length=s}function a(t,n,i,o){var a,u,s,c=o.length,h=t.length,f=new Map,p=[null,null].concat(l),_=new Array(h);for(n.length=0,n.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=r.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=r.apply(t._parent,p),(u=f.get(s))?u!==!0&&(t[a]=u,u.__data__=o[a]):n[a]=new e(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=r?a:o;return"function"!=typeof t&&(t=n(t)),i(this._root,this.enter()._root,this.exit()._root,c),this};e.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=r(t._root,t._depth)},C=function(t){return new d(i(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 o(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=a),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 u(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(s),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=l(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=h(e,u,arguments);a&&(l=f(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:p:u?i:o))},et=function(t,e){function n(){return _(this,t,e)}function r(){return _(this,t,e.apply(this,arguments))}return this.each("function"==typeof e?r:n)};d.prototype={select:v,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 d(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=g()),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 d(e,1)},ut=function(t,e,n){arguments.length<3&&(n=e,e=g().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=g().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:d,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)}(this);
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);
{
"name": "d3-selection",
"version": "0.3.0",
"version": "0.4.0",
"description": "Data-driven DOM manipulation.",
"main": "index",
"main": "d3-selection",
"repository": {

@@ -11,3 +11,3 @@ "type": "git",

"devDependencies": {
"d3-bundler": "0.1",
"d3-bundler": "0.2",
"faucet": "0.0",

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

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

// The leaf groups of the selection hierarchy are initially NodeList,

@@ -3,0 +2,0 @@ // and then lazily converted to arrays when mutation is required.

import Selection from "./selection";
import selectorAllOf from "./selectorAllOf";

@@ -49,1 +48,7 @@ // The selector may either be a selector string (e.g., ".foo")

};
function selectorAllOf(selector) {
return function() {
return this.querySelectorAll(selector);
};
}
var tape = require("tape"),
path = require("path"),
d3 = require("../"),
requirejs = require("requirejs");
tape("can load as a CommonJS module", function(test) {
test.equal(typeof d3.select, "function");
test.equal(global.d3, d3);
test.end();
});
tape("can load as AMD module", function(test) {
delete global.d3;
requirejs([path.join(__dirname, "../d3-selection")], function(d3) {
test.equal(typeof d3.select, "function", "d3.select is a function");
test.equal(typeof d3.select, "function");
test.end();
delete global.d3;
global.d3 = d3;
});

@@ -17,6 +24,6 @@ });

requirejs([path.join(__dirname, "../d3-selection.min")], function(d3) {
test.equal(typeof d3.select, "function", "d3.select is a function");
test.equal(typeof d3.select, "function");
test.end();
delete global.d3;
global.d3 = d3;
});
});
var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");
tape("d3.select can select by string", function(test) {
var document = global.document = jsdom.jsdom(),
s = d3.select("body");
test.ok(s instanceof d3.selection);
test.equal(s._depth, 1);
test.ok(Array.isArray(s._root));
test.equal(s._root.length, 1);
test.equal(s._root[0], document.body);
test.equal(s._root._parent, document.documentElement);
test.equal(s._enter, null);
test.equal(s._exit, null);
test.end();
delete global.document;
});
tape("d3.select can select an element", function(test) {

@@ -6,0 +21,0 @@ var document = jsdom.jsdom("<h1>hello</h1>"),

var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");
tape("d3.selectAll can select by string", function(test) {
var document = global.document = jsdom.jsdom(),
s = d3.selectAll("body");
test.ok(s instanceof d3.selection);
test.equal(s._depth, 1);
test.ok(s._root instanceof document.defaultView.NodeList);
test.equal(s._root.length, 1);
test.equal(s._root[0], document.body);
test.equal(s._root._parent, document.documentElement);
test.equal(s._enter, null);
test.equal(s._exit, null);
test.end();
delete global.document;
});
tape("d3.selectAll can select an array of elements", function(test) {

@@ -6,0 +21,0 @@ var document = jsdom.jsdom("<h1>hello</h1><h2>world</h2>"),

var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");

@@ -5,0 +5,0 @@ tape("selection.enter initially returns an empty selection", function(test) {

var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");

@@ -5,0 +5,0 @@ tape("selection.event registers a listener which receives events", function(test) {

var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");

@@ -5,0 +5,0 @@ tape("selection.exit initially returns an empty selection", function(test) {

var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");

@@ -5,0 +5,0 @@ tape("selection.select can select elements (in the simplest case)", function(test) {

var tape = require("tape"),
jsdom = require("jsdom"),
d3 = require("../d3-selection");
d3 = require("../");

@@ -5,0 +5,0 @@ tape("selection.selectAll can select elements (in the simplest case)", function(test) {

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