I am working with jQuery to modify svg data on the fly ... one of the things I need to do is change the "viewBox" attribute. However, when using jQuery, as in the snippet below, it does toLower () for the attribute, so the βviewBoxβ becomes the βviewboxβ. Normally, I wouldn't care, but that seems to have broken svg rendering (at least on Mac OS X in the search device and in Safari).
Is there a way to change this initially in jQuery (via a flag or something like that), or will I have to replace the string after that?
var $svg = $('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"></svg>'); // do some work here $svg.attr('viewBox', 0 + ' ' + 0 + ' ' + 288 + ' ' + 288);
source share