How to find a DOM element by its text content?
问题 I try to add new SVG elements to some nodes. For that purpose the nodes the elements are to be added to have to be found by a string contained in there text content, e.g. find any node which has "id0" inside the <text> tag. Here is example of my HTML hierarchy: <pre> <svg> <g> <g> <text> id3 </text> <text> 73% </text> <svg> ... </svg> </g> <g> <svg> ... </svg> </g> <g> <text> id0 </text> <text> 11% </text> <svg> ... </svg> </g> <g> <text> id1 </text> <text> 66% </text> <svg> ... </svg> </g>