| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | const aliases = new Map([ |
| 11 | ['acceptCharset', 'accept-charset'], |
| 12 | ['htmlFor', 'for'], |
| 13 | ['httpEquiv', 'http-equiv'], |
| 14 | // HTML and SVG attributes, but the SVG attribute is case sensitive.], |
| 15 | ['crossOrigin', 'crossorigin'], |
| 16 | // This is a list of all SVG attributes that need special casing. |
| 17 | // Regular attributes that just accept strings.], |
| 18 | ['accentHeight', 'accent-height'], |
| 19 | ['alignmentBaseline', 'alignment-baseline'], |
| 20 | ['arabicForm', 'arabic-form'], |
| 21 | ['baselineShift', 'baseline-shift'], |
| 22 | ['capHeight', 'cap-height'], |
| 23 | ['clipPath', 'clip-path'], |
| 24 | ['clipRule', 'clip-rule'], |
| 25 | ['colorInterpolation', 'color-interpolation'], |
| 26 | ['colorInterpolationFilters', 'color-interpolation-filters'], |
| 27 | ['colorProfile', 'color-profile'], |
| 28 | ['colorRendering', 'color-rendering'], |
| 29 | ['dominantBaseline', 'dominant-baseline'], |
| 30 | ['enableBackground', 'enable-background'], |
| 31 | ['fillOpacity', 'fill-opacity'], |
| 32 | ['fillRule', 'fill-rule'], |
| 33 | ['floodColor', 'flood-color'], |
| 34 | ['floodOpacity', 'flood-opacity'], |
| 35 | ['fontFamily', 'font-family'], |
| 36 | ['fontSize', 'font-size'], |
| 37 | ['fontSizeAdjust', 'font-size-adjust'], |
| 38 | ['fontStretch', 'font-stretch'], |
| 39 | ['fontStyle', 'font-style'], |
| 40 | ['fontVariant', 'font-variant'], |
| 41 | ['fontWeight', 'font-weight'], |
| 42 | ['glyphName', 'glyph-name'], |
| 43 | ['glyphOrientationHorizontal', 'glyph-orientation-horizontal'], |
| 44 | ['glyphOrientationVertical', 'glyph-orientation-vertical'], |
| 45 | ['horizAdvX', 'horiz-adv-x'], |
| 46 | ['horizOriginX', 'horiz-origin-x'], |
| 47 | ['imageRendering', 'image-rendering'], |
| 48 | ['letterSpacing', 'letter-spacing'], |
| 49 | ['lightingColor', 'lighting-color'], |
| 50 | ['markerEnd', 'marker-end'], |
| 51 | ['markerMid', 'marker-mid'], |
| 52 | ['markerStart', 'marker-start'], |
| 53 | ['maskType', 'mask-type'], |
| 54 | ['overlinePosition', 'overline-position'], |
| 55 | ['overlineThickness', 'overline-thickness'], |
| 56 | ['paintOrder', 'paint-order'], |
| 57 | ['panose-1', 'panose-1'], |
| 58 | ['pointerEvents', 'pointer-events'], |
| 59 | ['renderingIntent', 'rendering-intent'], |
| 60 | ['shapeRendering', 'shape-rendering'], |
| 61 | ['stopColor', 'stop-color'], |
| 62 | ['stopOpacity', 'stop-opacity'], |
| 63 | ['strikethroughPosition', 'strikethrough-position'], |
| 64 | ['strikethroughThickness', 'strikethrough-thickness'], |
| 65 | ['strokeDasharray', 'stroke-dasharray'], |
| 66 | ['strokeDashoffset', 'stroke-dashoffset'], |
| 67 | ['strokeLinecap', 'stroke-linecap'], |
| 68 | ['strokeLinejoin', 'stroke-linejoin'], |
| 69 | ['strokeMiterlimit', 'stroke-miterlimit'], |
| 70 | ['strokeOpacity', 'stroke-opacity'], |
| 71 | ['strokeWidth', 'stroke-width'], |
| 72 | ['textAnchor', 'text-anchor'], |
| 73 | ['textDecoration', 'text-decoration'], |
| 74 | ['textRendering', 'text-rendering'], |
| 75 | ['transformOrigin', 'transform-origin'], |
| 76 | ['underlinePosition', 'underline-position'], |
| 77 | ['underlineThickness', 'underline-thickness'], |
| 78 | ['unicodeBidi', 'unicode-bidi'], |
| 79 | ['unicodeRange', 'unicode-range'], |
| 80 | ['unitsPerEm', 'units-per-em'], |
| 81 | ['vAlphabetic', 'v-alphabetic'], |
| 82 | ['vHanging', 'v-hanging'], |
| 83 | ['vIdeographic', 'v-ideographic'], |
| 84 | ['vMathematical', 'v-mathematical'], |
| 85 | ['vectorEffect', 'vector-effect'], |
| 86 | ['vertAdvY', 'vert-adv-y'], |
| 87 | ['vertOriginX', 'vert-origin-x'], |
| 88 | ['vertOriginY', 'vert-origin-y'], |
| 89 | ['wordSpacing', 'word-spacing'], |
| 90 | ['writingMode', 'writing-mode'], |
| 91 | ['xmlnsXlink', 'xmlns:xlink'], |
| 92 | ['xHeight', 'x-height'], |
| 93 | ]); |
| 94 | |
| 95 | export default function (name: string): string { |
| 96 | return aliases.get(name) || name; |
| 97 | } |