Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6.3k
Fix form property assignment edge case#35073
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| setAttribute:(name:string,value:string)=>void; | ||
| }&Record<string,any> | ||
| exportfunctionassignElementProperty(el:ElementWithAssignableProperties,kebabName:string,val:string){ |
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.
Why notElement orHTMLElement?
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.
silverwindJul 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Shouldn'tkeyof typeof Element work for the property access?
constcamelizedName:keyoftypeofElement=camelize(kebabName);
silverwindJul 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
If not, use(el as any)[camelizedName] = ... to assign. Better do dirty stuff within a function than to exposeany to consumers.
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.
I don't see a clearer solution.
Feel free to edit this PR directly with your solution.
692c90e intogo-gitea:mainUh oh!
There was an error while loading.Please reload this page.
"form" has an edge case: its `<input name=action>` element overwritesthe `action` property, we can only set attribute.This PR makes `assignElementProperty` can handle such case, and add moretests
* giteaofficial/main: Send email on Workflow Run Success/Failure (go-gitea#34982) [skip ci] Updated translations via Crowdin Replace `poetry` with `uv` (go-gitea#35084) nix flake update (go-gitea#35085) Use monospace font in PR command line instructions (go-gitea#35074) Add gitignore rules to exclude LLM instruction files (go-gitea#35076) [skip ci] Updated translations via Crowdin Fix form property assignment edge case (go-gitea#35073) Improve submodule relative path handling (go-gitea#35056) Fixed all grammatical errors in locale_en-US.ini (go-gitea#35053) UI: add hover background to table rows in user and repo admin page (go-gitea#35072)

Uh oh!
There was an error while loading.Please reload this page.
"form" has an edge case: its
<input name=action>element overwrites theactionproperty, we can only set attribute.This PR makes
assignElementPropertycan handle such case, and add more tests