),
).toBe(` viewBox="foo"`)
})
+
+ test('ignore attr names containing carriage returns', () => {
+ expect(
+ ssrRenderAttrs({
+ id: 'safe',
+ ['x\rautofocus\ronfocus']: 'alert(1)',
+ }),
+ ).toBe(` id="safe"`)
+ expect(`unsafe attribute name`).toHaveBeenWarned()
+ expect(`Skipped rendering unsafe attribute name`).toHaveBeenWarned()
+ })
})
describe('ssr: renderAttr', () => {
return !!value || value === ''
}
-const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/
+const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/
const attrValidationCache: Record<string, boolean> = {}
export function isSSRSafeAttrName(name: string): boolean {