Skip to content
Myr

perf(jsx): skip the special behavior when the element is in the head. (#3352)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Taku Amano · committed by GitHub · parent 0712530 · Browse files · 3 files+34 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+34 added−4 removed

  • tests:+15 added−0 removed
  • other:+19 added−4 removed

3 files+34 added−4 removed

modified:src/jsx/intrinsic-element/components.ts+18 added-3 removed
modified:src/jsx/base.ts+1 added-1 removed
325 unmodified lines
326 intrinsicElementTags[tag as keyof typeof intrinsicElementTags],327 props,328 children329 )330 } else if (tag === 'svg') {330 } else if (tag === 'svg' || tag === 'head') {331 nameSpaceContext ||= createContext('')332 return new JSXNode(tag, props, [333 new JSXFunctionNode(334 nameSpaceContext,
85 unmodified lines
modified:src/jsx/index.test.tsx+15 added
468 unmodified lines
469 const template = <span data-text={escapedString}>Hello</span>470 expect(template.toString()).toBe('<span data-text="&lt;html-escaped-string&gt;">Hello</span>')471 })472 })473474 describe('head', () => {475 it('Simple head elements should be rendered as is', () => {476 const template = (477 <head>478 <title>Hono!</title>479 <meta name='description' content='A description' />480 <script src='script.js'></script>481 </head>482 )483 expect(template.toString()).toBe(484 '<head><title>Hono!</title><meta name="description" content="A description"/><script src="script.js"></script></head>'485 )486 })487 })488})489490describe('className', () => {491 it('should convert to class attribute for intrinsic elements', () => {
575 unmodified lines