Closed iconexperience closed 6 years ago
The structure of the <style>
element looks like this:
A style element can contain the style data either as plain text or as a CDATA section. Here is a first approach that seems to work in both cases:
if (element.tagName == 'style') {
element.textContent = element.textContent.replace(funcIriRegExp, 'url(#$1' + idSuffix + ')');
}
Update: Using element.innerHTML
does not work on Internet Explorer, therefore we use textContent
.
Some graphic software like Corel Draw export SVGs with the style embedded into a CDATA element. Currently IDs inside CDATA elements are not converted, and it may be difficult to implement this.
Here is an example SVG: