javascript - How to avoid shadow-root in MathJax? -
i want access svg code created mathjax via javascript. apparently, mathjax put svg <path> under shadow-root, not directly accessible javascript. here picture of elements given chrome
if <svg> element javascript method, <path> children not included.
you cannot avoid shadow-root. not put there mathjax renderer. because of use tag. mdn:
the
<use>element takes nodes within svg document, , duplicates them somewhere else.
so mathjax creates svg pathes , gives them ids , reuses them. letter a rendered svg, , mathjax stores in svg id , use when letter a needed rendered.
below example mdn speaks better.
<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"> <style> .classa { fill: red; } </style> <defs> <g id="port"> <circle style="fill: inherit;" r="10"/> </g> </defs> <text y="15">black</text> <use x="50" y="10" href="#port" /> <text y="35">red</text> <use x="50" y="30" href="#port" class="classa"/> <text y="55">blue</text> <use x="50" y="50" href="#port" style="fill: blue;"/> </svg> 
Comments
Post a Comment