From 6c6a03f3a17de3ee10f31c36ae4e29f211710319 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 18 Apr 2017 19:12:27 -0400 Subject: [PATCH] use map rather than object --- src/validate/html/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/validate/html/index.js b/src/validate/html/index.js index 7c791a600b..13b627f73a 100644 --- a/src/validate/html/index.js +++ b/src/validate/html/index.js @@ -4,9 +4,9 @@ import validateWindow from './validateWindow.js'; const svg = /^(?:altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform|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|hatch|hatchpath|hkern|image|line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata|missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor|stop|switch|symbol|text|textPath|title|tref|tspan|unknown|use|view|vkern)$/; -const meta = { - ':Window': validateWindow -}; +const meta = new Map([ + [ ':Window', validateWindow ] +]); export default function validateHtml ( validator, html ) { let elementDepth = 0; @@ -17,8 +17,8 @@ export default function validateHtml ( validator, html ) { validator.warn( `<${node.name}> is an SVG element – did you forget to add { namespace: 'svg' } ?`, node.start ); } - if ( node.name in meta ) { - return meta[ node.name ]( validator, node ); + if ( meta.has( node.name ) ) { + return meta.get( node.name )( validator, node ); } elementDepth += 1;