skip to Main Content

Javascript in my SVG files do not run when wrapped in CDATA tags – CSS

I have an SVG file in the form of the following: <svg id="test" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 1435 1084"> <style type="text/css"> svg{background:red} </style> <script type="text/javascript">//<![CDATA[ const x=1; const y=1; if (x===y){ document.getElementById('test').append('<style type="text/css">svg{background:blue}</style>'); }else{} //]]></script> </svg> What I…

VIEW QUESTION
Back To Top
Search