See Sketchy Avatars with CSS clip-path for background.
Useful tip: JQuery doesn't speak SVG. However, you can sidestep the issue by getting JQuery to use the HTML parser to interpret some SVG markup added as a child of an HTML element. Or you can skip JQuery and use the
innerHTML property of the same dummy HTML element.