2014-01-10 01:54:49 +04:00
|
|
|
var document = require("jsdom").jsdom("<html><head></head><body></body></html>"),
|
|
|
|
window = document.createWindow(),
|
|
|
|
globals = {};
|
|
|
|
|
|
|
|
// stash globals
|
|
|
|
if ("window" in global) globals.window = global.window;
|
|
|
|
global.window = window;
|
2014-01-10 02:03:03 +04:00
|
|
|
if ("document" in global) globals.document = global.document;
|
2014-01-10 01:54:49 +04:00
|
|
|
global.document = document;
|
2013-06-27 20:46:35 +04:00
|
|
|
|
|
|
|
// https://github.com/chad3814/CSSStyleDeclaration/issues/3
|
|
|
|
var CSSStyleDeclaration_prototype = window.CSSStyleDeclaration.prototype,
|
|
|
|
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 + "");
|
|
|
|
};
|
|
|
|
|
2014-01-10 01:54:49 +04:00
|
|
|
module.exports = require("./d3");
|
|
|
|
|
|
|
|
// restore globals
|
|
|
|
if ("window" in globals) global.window = globals.window;
|
2014-01-10 02:03:03 +04:00
|
|
|
else delete global.window;
|
2014-01-10 01:54:49 +04:00
|
|
|
if ("document" in globals) global.document = globals.document;
|
2014-01-10 02:03:03 +04:00
|
|
|
else delete global.document;
|