Test case details

Preparation Code

const nonTextSvgTagNames = [ // 'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'animation', 'audio', 'canvas', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', // 'desc', 'discard', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignObject', 'g', 'glyph', 'glyphRef', 'handler', 'hkern', 'iframe', 'image', 'line', 'linearGradient', 'listener', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'prefetch', 'radialGradient', 'rect', 'script', 'set', 'solidColor', 'stop', 'style', 'svg', 'switch', 'symbol', 'tbreak', // 'text', // 'textArea', 'textPath', // 'title', 'tref', // 'tspan', 'unknown', 'use', 'video', 'view', 'vkern' ] nonTextSvgTagNamesObj = Object.fromEntries(nonTextSvgTagNames.map(n => [n, true])); const entries = Array.from({length: 10_000}, (v, i) => nonTextSvgTagNames[i % nonTextSvgTagNames.length])

Test cases

Test #1

function isSvgIO(tag) { return nonTextSvgTagNames.indexOf(tag) !== -1; } entries.forEach(isSvgIO)

Test #2

function isSvgH(tag) { return !!nonTextSvgTagNamesObj[tag]; } entries.forEach(isSvgH)