Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/runtime-dom/src/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ export interface IntrinsicElementAttributes {
s: HTMLAttributes
samp: HTMLAttributes
script: ScriptHTMLAttributes
search: HTMLAttributes
section: HTMLAttributes
select: SelectHTMLAttributes
small: HTMLAttributes
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/domTagConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.


// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
const SVG_TAGS =
Expand Down