Commit 183060d4 authored by Mike Bostock's avatar Mike Bostock
Browse files

Upgrade dependencies; remove Sizzle dependency.

parent 11a19ec0
{
"name": "d3",
"version": "3.0.4",
"version": "3.0.5",
"main": "./d3.js"
}
......@@ -12,7 +12,7 @@
};
}
d3 = {
version: "3.0.4"
version: "3.0.5"
};
var π = Math.PI, ε = 1e-6, d3_radians = π / 180, d3_degrees = 180 / π;
function d3_target(d) {
......
This diff is collapsed.
var document = global.document = require("jsdom").jsdom("<html><head></head><body></body></html>"),
window = global.window = document.createWindow(),
navigator = global.navigator = window.navigator,
getComputedStyle = global.getComputedStyle = window.getComputedStyle,
CSSStyleDeclaration = global.CSSStyleDeclaration = window.CSSStyleDeclaration;
// https://github.com/chad3814/CSSStyleDeclaration/issues/3
var CSSStyleDeclaration_setProperty = CSSStyleDeclaration.prototype.setProperty;
CSSStyleDeclaration.prototype.setProperty = function(name, value, priority) {
return CSSStyleDeclaration_setProperty.call(this, name + "", value == null ? null : value + "", priority == null ? null : priority + "");
};
var self = this,
globals = ["document", "window", "navigator", "CSSStyleDeclaration", "d3", "Sizzle"],
var globals = ["document", "window", "navigator", "CSSStyleDeclaration", "getComputedStyle", "d3"],
globalValues = {};
globals.forEach(function(global) {
if (global in self) globalValues[global] = self[global];
globals.forEach(function(g) {
if (g in global) globalValues[g] = global[g];
});
document = require("jsdom").jsdom("<html><head></head><body></body></html>");
window = document.createWindow();
navigator = window.navigator;
CSSStyleDeclaration = window.CSSStyleDeclaration;
Sizzle = require("sizzle");
require("./globals");
require("./d3");
module.exports = d3;
globals.forEach(function(global) {
if (global in globalValues) self[global] = globalValues[global];
else delete self[global];
globals.forEach(function(g) {
if (g in globalValues) global[g] = globalValues[g];
else delete global[g];
});
Copyright (c) 2009, John Resig
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY John Resig ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This diff is collapsed.
(function(){function y(a,b,c,d,e,f){e=0;for(var h=d.length;e<h;e++){var g=d[e];if(g){var l=false;for(g=g[a];g;){if(g.sizcache===c){l=d[g.sizset];break}if(g.nodeType===1&&!f){g.sizcache=c;g.sizset=e}if(g.nodeName.toLowerCase()===b){l=g;break}g=g[a]}d[e]=l}}}function z(a,b,c,d,e,f){e=0;for(var h=d.length;e<h;e++){var g=d[e];if(g){var l=false;for(g=g[a];g;){if(g.sizcache===c){l=d[g.sizset];break}if(g.nodeType===1){if(!f){g.sizcache=c;g.sizset=e}if(typeof b!=="string"){if(g===b){l=true;break}}else if(i.filter(b,
[g]).length>0){l=g;break}}g=g[a]}d[e]=l}}}var w=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,x=0,A=Object.prototype.toString,s=false,B=true;[0,0].sort(function(){B=false;return 0});var i=function(a,b,c,d){c=c||[];var e=b=b||document;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!=="string")return c;var f,h,g,l,p,n=true,m=i.isXML(b),k=[],t=a;do{w.exec("");if(f=w.exec(t)){t=f[3];k.push(f[1]);if(f[2]){l=
f[3];break}}}while(f);if(k.length>1&&E.exec(a))if(k.length===2&&j.relative[k[0]])h=C(k[0]+k[1],b);else for(h=j.relative[k[0]]?[b]:i(k.shift(),b);k.length;){a=k.shift();if(j.relative[a])a+=k.shift();h=C(a,h)}else{if(!d&&k.length>1&&b.nodeType===9&&!m&&j.match.ID.test(k[0])&&!j.match.ID.test(k[k.length-1])){f=i.find(k.shift(),b,m);b=f.expr?i.filter(f.expr,f.set)[0]:f.set[0]}if(b){f=d?{expr:k.pop(),set:o(d)}:i.find(k.pop(),k.length===1&&(k[0]==="~"||k[0]==="+")&&b.parentNode?b.parentNode:b,m);h=f.expr?
i.filter(f.expr,f.set):f.set;if(k.length>0)g=o(h);else n=false;for(;k.length;){f=p=k.pop();if(j.relative[p])f=k.pop();else p="";if(f==null)f=b;j.relative[p](g,f,m)}}else g=[]}g||(g=h);g||i.error(p||a);if(A.call(g)==="[object Array]")if(n)if(b&&b.nodeType===1)for(a=0;g[a]!=null;a++){if(g[a]&&(g[a]===true||g[a].nodeType===1&&i.contains(b,g[a])))c.push(h[a])}else for(a=0;g[a]!=null;a++)g[a]&&g[a].nodeType===1&&c.push(h[a]);else c.push.apply(c,g);else o(g,c);if(l){i(l,e,c,d);i.uniqueSort(c)}return c};
i.uniqueSort=function(a){if(u){s=B;a.sort(u);if(s)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a};i.matches=function(a,b){return i(a,null,null,b)};i.matchesSelector=function(a,b){return i(b,null,null,[a]).length>0};i.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=j.order.length;e<f;e++){var h,g=j.order[e];if(h=j.leftMatch[g].exec(a)){var l=h[1];h.splice(1,1);if(l.substr(l.length-1)!=="\\"){h[1]=(h[1]||"").replace(/\\/g,"");d=j.find[g](h,b,c);if(d!=null){a=a.replace(j.match[g],
"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}};i.filter=function(a,b,c,d){for(var e,f,h=a,g=[],l=b,p=b&&b[0]&&i.isXML(b[0]);a&&b.length;){for(var n in j.filter)if((e=j.leftMatch[n].exec(a))!=null&&e[2]){var m,k,t=j.filter[n];k=e[1];f=false;e.splice(1,1);if(k.substr(k.length-1)!=="\\"){if(l===g)g=[];if(j.preFilter[n])if(e=j.preFilter[n](e,l,c,g,d,p)){if(e===true)continue}else f=m=true;if(e)for(var v=0;(k=l[v])!=null;v++)if(k){m=
t(k,e,v,l);var D=d^!!m;if(c&&m!=null)if(D)f=true;else l[v]=false;else if(D){g.push(k);f=true}}if(m!==undefined){c||(l=g);a=a.replace(j.match[n],"");if(!f)return[];break}}}if(a===h)if(f==null)i.error(a);else break;h=a}return l};i.error=function(a){throw"Syntax error, unrecognized expression: "+a;};var j=i.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!/\W/.test(b);c=c&&
!d;if(d)b=b.toLowerCase();d=0;for(var e=a.length,f;d<e;d++)if(f=a[d]){for(;(f=f.previousSibling)&&f.nodeType!==1;);a[d]=c||f&&f.nodeName.toLowerCase()===b?f||false:f===b}c&&i.filter(b,a,true)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!/\W/.test(b))for(b=b.toLowerCase();e<f;e++){if(c=a[e]){c=c.parentNode;a[e]=c.nodeName.toLowerCase()===b?c:false}}else{for(;e<f;e++)if(c=a[e])a[e]=d?c.parentNode:c.parentNode===b;d&&i.filter(b,a,true)}},"":function(a,b,c){var d,e=x++,f=z;if(typeof b===
"string"&&!/\W/.test(b)){d=b=b.toLowerCase();f=y}f("parentNode",b,e,a,d,c)},"~":function(a,b,c){var d,e=x++,f=z;if(typeof b==="string"&&!/\W/.test(b)){d=b=b.toLowerCase();f=y}f("previousSibling",b,e,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c)return(a=b.getElementById(a[1]))&&a.parentNode?[a]:[]},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){for(var c=[],d=b.getElementsByName(a[1]),e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);
return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(/\\/g,"")+" ";if(f)return a;f=0;for(var h;(h=b[f])!=null;f++)if(h)if(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0))c||d.push(h);else if(c)b[f]=false;return false},ID:function(a){return a[1].replace(/\\/g,"")},TAG:function(a){return a[1].toLowerCase()},CHILD:function(a){if(a[1]===
"nth"){a[2]||i.error(a[0]);a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0;a[3]=b[3]-0}else a[2]&&i.error(a[0]);a[0]=x++;return a},ATTR:function(a,b,c,d,e,f){b=a[1]=a[1].replace(/\\/g,"");if(!f&&j.attrMap[b])a[1]=j.attrMap[b];a[4]=(a[4]||a[5]||"").replace(/\\/g,"");if(a[2]==="~=")a[4]=" "+a[4]+" ";return a},PSEUDO:function(a,b,c,d,e){if(a[1]==="not")if((w.exec(a[3])||"").length>
1||/^\w/.test(a[3]))a[3]=i(a[3],null,null,b);else{a=i.filter(a[3],b,c,true^e);c||d.push.apply(d,a);return false}else if(j.match.POS.test(a[0])||j.match.CHILD.test(a[0]))return true;return a},POS:function(a){a.unshift(true);return a}},filters:{enabled:function(a){return a.disabled===false&&a.type!=="hidden"},disabled:function(a){return a.disabled===true},checked:function(a){return a.checked===true},selected:function(a){return a.selected===true},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},
has:function(a,b,c){return!!i(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.type},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()===
"button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=j.filters[e];if(f)return f(a,c,b,d);else if(e==="contains")return(a.textContent||
a.innerText||i.getText([a])||"").indexOf(b[3])>=0;else if(e==="not"){b=b[3];c=0;for(d=b.length;c<d;c++)if(b[c]===a)return false;return true}else i.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case "only":case "first":for(;d=d.previousSibling;)if(d.nodeType===1)return false;if(c==="first")return true;d=a;case "last":for(;d=d.nextSibling;)if(d.nodeType===1)return false;return true;case "nth":c=b[2];var e=b[3];if(c===1&&e===0)return true;var f=b[0],h=a.parentNode;if(h&&(h.sizcache!==f||!a.nodeIndex)){var g=
0;for(d=h.firstChild;d;d=d.nextSibling)if(d.nodeType===1)d.nodeIndex=++g;h.sizcache=f}d=a.nodeIndex-e;return c===0?d===0:d%c===0&&d/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1];c=j.attrHandle[c]?j.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c);var d=c+"",e=b[2],f=b[4];
return c==null?e==="!=":e==="="?d===f:e==="*="?d.indexOf(f)>=0:e==="~="?(" "+d+" ").indexOf(f)>=0:!f?d&&c!==false:e==="!="?d!==f:e==="^="?d.indexOf(f)===0:e==="$="?d.substr(d.length-f.length)===f:e==="|="?d===f||d.substr(0,f.length+1)===f+"-":false},POS:function(a,b,c,d){var e=j.setFilters[b[2]];if(e)return e(a,c,b,d)}}},E=j.match.POS,F=function(a,b){return"\\"+(b-0+1)},q;for(q in j.match){j.match[q]=RegExp(j.match[q].source+/(?![^\[]*\])(?![^\(]*\))/.source);j.leftMatch[q]=RegExp(/(^(?:.|\r|\n)*?)/.source+
j.match[q].source.replace(/\\(\d+)/g,F))}var o=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(G){o=function(a,b){var c=0,d=b||[];if(A.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,r;if(document.documentElement.compareDocumentPosition)u=function(a,
b){if(a===b){s=true;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1};else{u=function(a,b){var c,d,e=[],f=[];c=a.parentNode;d=b.parentNode;var h=c;if(a===b){s=true;return 0}else if(c===d)return r(a,b);else if(c){if(!d)return 1}else return-1;for(;h;){e.unshift(h);h=h.parentNode}for(h=d;h;){f.unshift(h);h=h.parentNode}c=e.length;d=f.length;for(h=0;h<c&&h<d;h++)if(e[h]!==f[h])return r(e[h],f[h]);return h===
c?r(a,f[h],-1):r(e[h],b,1)};r=function(a,b,c){if(a===b)return c;for(a=a.nextSibling;a;){if(a===b)return-1;a=a.nextSibling}return 1}}i.getText=function(a){for(var b="",c,d=0;a[d];d++){c=a[d];if(c.nodeType===3||c.nodeType===4)b+=c.nodeValue;else if(c.nodeType!==8)b+=i.getText(c.childNodes)}return b};(function(){var a=document.createElement("div"),b="script"+(new Date).getTime(),c=document.documentElement;a.innerHTML="<a name='"+b+"'/>";c.insertBefore(a,c.firstChild);if(document.getElementById(b)){j.find.ID=
function(d,e,f){if(typeof e.getElementById!=="undefined"&&!f)return(e=e.getElementById(d[1]))?e.id===d[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===d[1]?[e]:undefined:[]};j.filter.ID=function(d,e){var f=typeof d.getAttributeNode!=="undefined"&&d.getAttributeNode("id");return d.nodeType===1&&f&&f.nodeValue===e}}c.removeChild(a);c=a=null})();(function(){var a=document.createElement("div");a.appendChild(document.createComment(""));if(a.getElementsByTagName("*").length>
0)j.find.TAG=function(b,c){var d=c.getElementsByTagName(b[1]);if(b[1]==="*"){for(var e=[],f=0;d[f];f++)d[f].nodeType===1&&e.push(d[f]);d=e}return d};a.innerHTML="<a href='#'></a>";if(a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#")j.attrHandle.href=function(b){return b.getAttribute("href",2)};a=null})();document.querySelectorAll&&function(){var a=i,b=document.createElement("div");b.innerHTML="<p class='TEST'></p>";if(!(b.querySelectorAll&&b.querySelectorAll(".TEST").length===
0)){i=function(d,e,f,h){e=e||document;if(!h&&!i.isXML(e)){var g=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(d);if(g&&(e.nodeType===1||e.nodeType===9))if(g[1])return o(e.getElementsByTagName(d),f);else if(g[2]&&j.find.CLASS&&e.getElementsByClassName)return o(e.getElementsByClassName(g[2]),f);if(e.nodeType===9){if(d==="body"&&e.body)return o([e.body],f);else if(g&&g[3]){var l=e.getElementById(g[3]);if(l&&l.parentNode){if(l.id===g[3])return o([l],f)}else return o([],f)}try{return o(e.querySelectorAll(d),
f)}catch(p){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){l=(g=e.getAttribute("id"))||"__sizzle__";var n=e.parentNode,m=/^\s*[+~]/.test(d);if(g)l=l.replace(/'/g,"\\$&");else e.setAttribute("id",l);if(m&&n)e=e.parentNode;try{if(!m||n)return o(e.querySelectorAll("[id='"+l+"'] "+d),f)}catch(k){}finally{g||e.removeAttribute("id")}}}return a(d,e,f,h)};for(var c in a)i[c]=a[c];b=null}}();(function(){var a=document.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||
a.msMatchesSelector,c=false;try{b.call(document.documentElement,"[test!='']:sizzle")}catch(d){c=true}if(b)i.matchesSelector=function(e,f){f=f.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!i.isXML(e))try{if(c||!j.match.PSEUDO.test(f)&&!/!=/.test(f))return b.call(e,f)}catch(h){}return i(f,null,null,[e]).length>0}})();(function(){var a=document.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!a.getElementsByClassName||a.getElementsByClassName("e").length===
0)){a.lastChild.className="e";if(a.getElementsByClassName("e").length!==1){j.order.splice(1,0,"CLASS");j.find.CLASS=function(b,c,d){if(typeof c.getElementsByClassName!=="undefined"&&!d)return c.getElementsByClassName(b[1])};a=null}}})();i.contains=document.documentElement.contains?function(a,b){return a!==b&&(a.contains?a.contains(b):true)}:document.documentElement.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:function(){return false};i.isXML=function(a){return(a=
(a?a.ownerDocument||a:0).documentElement)?a.nodeName!=="HTML":false};var C=function(a,b){for(var c,d=[],e="",f=b.nodeType?[b]:b;c=j.match.PSEUDO.exec(a);){e+=c[0];a=a.replace(j.match.PSEUDO,"")}a=j.relative[a]?a+"*":a;c=0;for(var h=f.length;c<h;c++)i(a,f[c],d);return i.filter(e,d)};window.Sizzle=i})();
{
"name": "d3",
"version": "3.0.4",
"version": "3.0.5",
"description": "A small, free JavaScript library for manipulating documents based on data.",
"keywords": [
"dom",
......@@ -28,12 +28,11 @@
}
},
"dependencies": {
"jsdom": "0.2.14",
"sizzle": "1.1.x"
"jsdom": "0.3.4"
},
"devDependencies": {
"uglify-js": "2.2.2",
"vows": "0.6.x"
"uglify-js": "2.2.3",
"vows": "0.7.0"
},
"scripts": {
"test": "./node_modules/vows/bin/vows"
......
d3 = {version: "3.0.4"}; // semver
d3 = {version: "3.0.5"}; // semver
var π = Math.PI,
ε = 1e-6,
......
......@@ -17,12 +17,11 @@ require("util").puts(JSON.stringify({
}
},
"dependencies": {
"jsdom": "0.2.14",
"sizzle": "1.1.x"
"jsdom": "0.3.4"
},
"devDependencies": {
"uglify-js": "2.2.2",
"vows": "0.6.x"
"uglify-js": "2.2.3",
"vows": "0.7.0"
},
"scripts": {"test": "./node_modules/vows/bin/vows"}
}, null, 2));
......@@ -12,25 +12,25 @@ suite.addBatch({
},
"sets a property as a string": function(body) {
body.style("background-color", "red");
assert.equal(document.body.style["background-color"], "red");
assert.equal(document.body.style.getPropertyValue("background-color"), "red");
},
"sets a property as a number": function(body) {
body.style("opacity", .3);
assert.equal(document.body.style["opacity"], "0.3");
assert.equal(document.body.style.getPropertyValue("opacity"), "0.3");
},
"sets a property as a function": function(body) {
body.style("background-color", function() { return "orange"; });
assert.equal(document.body.style["background-color"], "orange");
assert.equal(document.body.style.getPropertyValue("background-color"), "orange");
},
"sets properties as a map of constants": function(body) {
body.style({"background-color": "white", opacity: .42});
assert.equal(document.body.style["background-color"], "white");
assert.equal(document.body.style["opacity"], "0.42");
assert.equal(document.body.style.getPropertyValue("background-color"), "white");
assert.equal(document.body.style.getPropertyValue("opacity"), "0.42");
},
"sets properties as a map of functions": function(body) {
body.data(["orange"]).style({"background-color": String, opacity: function(d, i) { return i; }});
assert.equal(document.body.style["background-color"], "orange");
assert.equal(document.body.style["opacity"], "0");
assert.equal(document.body.style.getPropertyValue("background-color"), "orange");
assert.equal(document.body.style.getPropertyValue("opacity"), "0");
},
"gets a property value": function(body) {
document.body.style.setProperty("background-color", "yellow", "");
......@@ -75,18 +75,18 @@ suite.addBatch({
},
"sets a property as a string": function(div) {
div.style("background-color", "red");
assert.equal(div[0][0].style["background-color"], "red");
assert.equal(div[0][1].style["background-color"], "red");
assert.equal(div[0][0].style.getPropertyValue("background-color"), "red");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "red");
},
"sets a property as a number": function(div) {
div.style("opacity", .5);
assert.equal(div[0][0].style["opacity"], "0.5");
assert.equal(div[0][1].style["opacity"], "0.5");
assert.equal(div[0][0].style.getPropertyValue("opacity"), "0.5");
assert.equal(div[0][1].style.getPropertyValue("opacity"), "0.5");
},
"sets a property as a function": function(div) {
div.style("background-color", d3.interpolateRgb("orange", "yellow"));
assert.equal(div[0][0].style["background-color"], "#ffa500");
assert.equal(div[0][1].style["background-color"], "#ffff00");
assert.equal(div[0][0].style.getPropertyValue("background-color"), "#ffa500");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "#ffff00");
},
"gets a property value": function(div) {
div[0][0].style.setProperty("background-color", "green", "");
......@@ -99,20 +99,20 @@ suite.addBatch({
},
"removes a property as null": function(div) {
div.style("background-color", "red").style("background-color", null);
assert.equal(div[0][0].style["background-color"], "");
assert.equal(div[0][1].style["background-color"], "");
assert.equal(div[0][0].style.getPropertyValue("background-color"), "");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "");
},
"removes a property as a function": function(div) {
div.style("background-color", "red").style("background-color", function() { return null; });
assert.equal(div[0][0].style["background-color"], "");
assert.equal(div[0][1].style["background-color"], "");
assert.equal(div[0][0].style.getPropertyValue("background-color"), "");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "");
},
"ignores null nodes": function(div) {
var some = d3.selectAll("div");
some[0][1] = null;
some.style("background-color", null).style("background-color", "red");
assert.equal(div[0][0].style["background-color"], "red");
assert.equal(div[0][1].style["background-color"], "");
assert.equal(div[0][0].style.getPropertyValue("background-color"), "red");
assert.equal(div[0][1].style.getPropertyValue("background-color"), "");
},
"returns the current selection": function(div) {
assert.isTrue(div.style("background-color", "green") === div);
......
document = require("jsdom").jsdom("<html><head></head><body></body></html>");
window = document.createWindow();
navigator = window.navigator;
CSSStyleDeclaration = window.CSSStyleDeclaration;
require("../lib/sizzle/sizzle");
Sizzle = window.Sizzle;
getComputedStyle = window.getComputedStyle;
process.env.TZ = "America/Los_Angeles";
require("../globals");
require("./env-assert");
require("./env-xhr");
require("./env-fragment");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment