I can't get the children from the svg fragment pre-entered in the string.
Need return content <g>
element from source string;
Example:
has dom:
<svg>
<g class="parent"> <rect ... /> </g>
<svg>
let strNewContent = '<g class="draggable-group" data-id-device="Light-X[room-1549613406671][0]"> <rect height="75" width="184" x="8" y="0" fill="#DDD" rx="6" ry="6" /> </g>'; // created svg string using handlebars.js
// need replace old content in new content
// need extrude `<rect ... /> & etc...` from string and put (innerSVG)
$('.parent').html($(strNewContent).html()) // I understand it won't work. (It's just to understand what I mean.)
d3.select(svgElem).html(d3.select(svgElem).html()); // костыль для обновления svg документа
ps:Thank you for your patience and understanding for my English
need extrude <rect ... /> & etc...
from string and put (innerSVG)
I understand that this can be done in 2 ways (as I can see): by a regular expression, cut the content or convert it to a fragment and try to squeeze out the content and add it to a new element as content (helped by @altocumulus). But I really already tried, many times to convert to a fragment and to squeeze out contents, nothing turns out (only now came to the decision, with a regular expression)(now I will experiment).
ps: What's best to correct (title) the issue for everyone to deal with this problem to solve it?