MCPcopy Create free account
hub / github.com/d3-node/d3-node / fixXmlCase

Function fixXmlCase

src/index.js:4–17  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

2import { JSDOM } from 'jsdom'
3
4function fixXmlCase (text) {
5 // Fix a jsdom issue where all SVG tagNames are lowercased:
6 // https://github.com/tmpvar/jsdom/issues/620
7 var tagNames = ['linearGradient', 'radialGradient', 'clipPath', 'textPath']
8 for (var i = 0, l = tagNames.length; i < l; i++) {
9 var tagName = tagNames[i]
10 text = text.replace(
11 new RegExp('(<|</)' + tagName.toLowerCase() + '\\b', 'g'),
12 function (all, start) {
13 return start + tagName
14 })
15 }
16 return text
17}
18
19export function D3Node ({ d3Module = d3, selector = '', container = '', styles = '', svgStyles = '', canvasModule = '' } = {}) {
20 // deprecates props

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected