-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Conversation
WalkthroughThe changes add support for the HTML Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this 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
📒 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 andsummary
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 betweenscript
andsection
, matching the surrounding order, and correctly typed asHTMLAttributes
.
@@ -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' |
There was a problem hiding this comment.
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.
Add
<search>
to known HTML elements.Spec:
Summary by CodeRabbit
<search>
HTML element in JSX, allowing it to accept standard HTML attributes.