Created
September 3, 2011 16:17
-
-
Save stesla/1191412 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function setAttrs(obj, attrs) { | |
_.each(attrs, function(value, attr) { | |
obj.setAttribute(attr, value); | |
}); | |
}; | |
var paper = document.getElementById("js-svg"); | |
var svgns = "http://www.w3.org/2000/svg"; | |
var svg = paper.appendChild(document.createElementNS(svgns,"svg")); | |
var rect = svg.appendChild(document.createElementNS(svgns,"rect")); | |
setAttrs(svg, {width: 768, height: 200}); | |
setAttrs(rect, {x: 68, y: 50, width: 632, height: 100, | |
fill: "blue"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment