Skip to content

chore: add <search> to known HTML elements #13728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

chirokas
Copy link
Contributor

@chirokas chirokas commented Aug 1, 2025

Add <search> to known HTML elements.

Spec:

Summary by CodeRabbit

  • New Features
    • Added support for the <search> HTML element in JSX, allowing it to accept standard HTML attributes.

Copy link

coderabbitai bot commented Aug 1, 2025

Walkthrough

The changes add support for the HTML <search> element by updating both the JSX typings and the recognized HTML tag list. The <search> tag is now included in the intrinsic element attributes and the HTML tag configuration, while the position of the <summary> tag is adjusted in the tag list.

Changes

Cohort / File(s) Change Summary
JSX Intrinsic Elements Update
packages/runtime-dom/src/jsx.ts
Added search: HTMLAttributes to IntrinsicElementAttributes interface, enabling JSX support for <search>.
HTML Tag Configuration
packages/shared/src/domTagConfig.ts
Modified HTML_TAGS constant to insert "search" and adjust the position of "summary" in the tag list.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

In the garden of tags, a new sprout appears,
The <search> blooms bright, dispelling old fears.
Summary shifts, making room in the row,
Now JSX welcomes a fresh tag to grow.
With every small change, our DOM hops ahead—
A rabbit’s delight in the code flowerbed! 🐇🌱

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Aug 1, 2025

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB 38.4 kB 34.6 kB
vue.global.prod.js 159 kB (+7 B) 58.6 kB (+5 B) 52.2 kB (+11 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.6 kB 18.2 kB 16.7 kB
createApp 54.6 kB 21.2 kB 19.4 kB
createSSRApp 58.8 kB 23 kB 20.9 kB
defineCustomElement 59.6 kB 22.8 kB 20.8 kB
overall 68.7 kB 26.4 kB 24.1 kB

Copy link

pkg-pr-new bot commented Aug 1, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13728

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13728

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13728

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13728

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13728

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13728

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13728

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13728

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13728

vue

npm i https://pkg.pr.new/vue@13728

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13728

commit: 0d6056c

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c875019 and 0d6056c.

📒 Files selected for processing (2)
  • packages/runtime-dom/src/jsx.ts (1 hunks)
  • packages/shared/src/domTagConfig.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/runtime-dom/src/jsx.ts (2)
packages/vue/jsx.d.ts (2)
  • IntrinsicElements (15-19)
  • IntrinsicAttributes (20-20)
packages/vue/jsx-runtime/index.d.ts (1)
  • IntrinsicElements (19-23)
🔇 Additional comments (2)
packages/shared/src/domTagConfig.ts (1)

15-15: search tag successfully added to HTML_TAGS
The <search> element is now part of the known tag set and summary remains in the list – implementation looks correct.

packages/runtime-dom/src/jsx.ts (1)

1176-1180: IntrinsicElementAttributes updated with <search> – looks good
The new entry is alphabetically placed between script and section, matching the surrounding order, and correctly typed as HTMLAttributes.

@@ -12,7 +12,7 @@ const HTML_TAGS =
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
'option,output,progress,select,textarea,details,dialog,menu,' +
'summary,template,blockquote,iframe,tfoot'
'search,summary,template,blockquote,iframe,tfoot'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Consider adding a duplicate-check to avoid future regressions
Maintaining a long comma-separated string by hand is error-prone; accidental duplicates can slip in unnoticed. A tiny CI sanity-check (or switching to an array literal that is new Set’ed) would prevent this.


🏁 Script executed:

#!/usr/bin/env bash
# Verify that HTML_TAGS contains no duplicate entries
python - <<'PY'
import re, pathlib, collections, sys, textwrap, itertools, os, json, typing, math
path = pathlib.Path("packages/shared/src/domTagConfig.ts")
code = path.read_text()
match = re.search(r"const HTML_TAGS\s*=([^;]+)", code, re.S)
if not match:
    sys.exit("HTML_TAGS not found")
tags_raw = match.group(1)
# strip concatenation quotes / commas
tags = re.findall(r"'([^']*)'", tags_raw)
flat = ",".join(tags).split(",")
dups = [t for t, c in collections.Counter(flat).items() if c > 1]
print("DUPLICATES:", dups if dups else "none")
PY

Length of output: 147


Remove Duplicate Entries in HTML_TAGS and Add a Sanity Check

A quick scan of packages/shared/src/domTagConfig.ts shows multiple duplicate tags (e.g. base, link, meta, title, hr, img, br, wbr, area, track, embed, param, source, col, input and an unexpected empty string). To address this and prevent future regressions:

  • Refactor the comma-separated literal into an array, then normalize via a Set:

    // Before
    const HTML_TAGS = 'a,area,base,base,br,col,embed,hr,hr,...';
    
    // After
    const HTML_TAGS_LIST = [
      'a','area','base','br','col','embed','hr', /*…*/
    ];
    export const HTML_TAGS = Array.from(new Set(HTML_TAGS_LIST)).join(',');
  • Add a CI unit test or small script that verifies HTML_TAGS_LIST contains no duplicates. For example, in Jest:

    test('HTML_TAGS_LIST has no duplicates', () => {
      const list = require('./domTagConfig').HTML_TAGS_LIST;
      expect(list.length).toBe(new Set(list).size);
    });

This ensures the list is maintained by hand but always de-duplicated at build or test time.

🤖 Prompt for AI Agents
In packages/shared/src/domTagConfig.ts at line 15, the HTML_TAGS string contains
duplicate tag entries and an unexpected empty string. Refactor by converting the
comma-separated string into an array named HTML_TAGS_LIST with unique tag names,
then create HTML_TAGS by joining the deduplicated array using Array.from(new
Set(HTML_TAGS_LIST)).join(','). Additionally, add a unit test in the CI pipeline
that imports HTML_TAGS_LIST and asserts that its length equals the size of a Set
created from it to ensure no duplicates exist in the list.

@Justineo
Copy link
Member

Justineo commented Aug 1, 2025

Duplicate of #9247

See #9249.

@Justineo Justineo closed this Aug 1, 2025
@chirokas chirokas deleted the search-element branch August 1, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants