import { attributeName } from '../core/attributes' const ATTR_MAP: Record = { '&': '&', '"': '"', '<': '<', '>': '>', } const TEXT_MAP: Record = { '&': '&', '<': '<', '>': '>', } export function escapeAttr(value: string): string { return value.replace(/[&"<>]/g, (c) => ATTR_MAP[c]!) } export function escapeText(value: string): string { return value.replace(/[&<>]/g, (c) => TEXT_MAP[c]!) } // Raw-text element body escaping: prevent any closing tag for the raw-text // elements (