Created
October 6, 2015 21:11
-
-
Save dallonf/42feeaa789109d5904d5 to your computer and use it in GitHub Desktop.
React can't render SVG under PhantomJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<svg id="svgRoot"> | |
<g id="gElement"> | |
</g> | |
</svg> | |
<script src="https://fb.me/react-0.14.0-rc1.js"></script> | |
<script src="https://fb.me/react-dom-0.14.0-rc1.js"></script> | |
<script type="text/javascript"> | |
var circle = React.createElement("circle", { | |
r: 50, | |
fill: "red", | |
cx: 50, | |
cy: 50, | |
}); | |
ReactDOM.render(circle, document.getElementById("gElement")); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
page.open('http://localhost:3000', function(status) { | |
console.log("Status: " + status); | |
if(status === "success") { | |
page.render('example.png'); | |
} | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment