0

I dynamically have to create a pattern with an image inside it and insert them inside a SVG tag.

I managed to put that pattern in that svg but the problem is that the pattern has a patterunits prop that I can't set in camelCase, when I insert it dynamically I don't know why it turn automatically in lowercase.

I've tried this so far to force the camelCase.

jQuery("pattern#p2").attr("width", '78').attr("height", '65').attr($.camelCase("pattern-units"), 'userSpaceOnUse');
jQuery("pattern#p2").attr("width", '78').attr("height", '65').attr("patternUnits", 'userSpaceOnUse');

I've tried the same with prop methods but it still doesn't work

Here is what I have at the end

<pattern id="p2" width="78" height="65" patternunits="userSpaceOnUse"><image xlink:href="linkOfAnImage"></image></pattern>

And here is what I want with the 'u' of patternunits in uppercase.

<pattern id="p2" width="78" height="65" patternUnits="userSpaceOnUse"><image xlink:href="linkOfAnImage"></image></pattern>
mplungjan
  • 169,008
  • 28
  • 173
  • 236
Souhib
  • 1
  • 1

0 Answers0