(value: string)
| 175 | * @returns The encoded attribute value. |
| 176 | */ |
| 177 | export function encodeAttributeValue(value: string): string { |
| 178 | // Fast path: no special characters means nothing to encode |
| 179 | if (!/[<>&'"\t\n\r]/.test(value)) return value; |
| 180 | return value.replace(ATTR_ENCODE_REGEXP, (c) => ATTR_ENTITY_MAP[c]!); |
| 181 | } |
no outgoing calls
no test coverage detected