Skip to content
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

fix(customElement): handle hyphenated prop pass to custom element #12032

Closed
wants to merge 6 commits into from

Conversation

linzhe141
Copy link
Contributor

close #12030

@linzhe141 linzhe141 marked this pull request as draft September 25, 2024 16:08
Copy link

github-actions bot commented Sep 25, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB (+3 B) 38 kB (+6 B) 34.2 kB
vue.global.prod.js 160 kB (+3 B) 58 kB (+3 B) 51.5 kB (+14 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 49 kB (+3 B) 18.9 kB (+3 B) 17.3 kB (+2 B)
createApp 55.6 kB (+3 B) 21.4 kB (+3 B) 19.5 kB (-38 B)
createSSRApp 59.6 kB (+3 B) 23.1 kB (+3 B) 21 kB (+1 B)
defineCustomElement 60.4 kB (+3 B) 22.9 kB (+3 B) 20.9 kB (-18 B)
overall 69.3 kB (+3 B) 26.5 kB (+4 B) 24 kB (+30 B)

Copy link

pkg-pr-new bot commented Sep 25, 2024

Open in Stackblitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@12032

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@12032

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@12032

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@12032

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@12032

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@12032

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@12032

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@12032

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@12032

vue

pnpm add https://pkg.pr.new/vue@12032

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@12032

commit: e5dbce5


if (key in el) {
// if el is a Vue custom element, it should be passed as a prop.
if (camelize(key) in el) {
Copy link
Member

Choose a reason for hiding this comment

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

this change is unnecessary. see line 142

@@ -95,7 +95,7 @@ export function patchDOMProp(
// some properties has getter, no setter, will error in 'use strict'
// eg. <select :type="null"></select> <select :willValidate="null"></select>
try {
el[key] = value
el[camelize(key)] = value
Copy link
Member

Choose a reason for hiding this comment

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

this is the proper change. because the normalized prop key is always camelized

@linzhe141 linzhe141 changed the title wip: fix patch prop fix(runtime-dom): patch DOM prop should use camelized key Sep 26, 2024
@linzhe141 linzhe141 marked this pull request as ready for review September 26, 2024 02:36
@linzhe141 linzhe141 changed the title fix(runtime-dom): patch DOM prop should use camelized key fix(customElement): handle hyphenated prop pass to custom element Sep 26, 2024
@edison1105 edison1105 added ready to merge The PR is ready to be merged. 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: custom elements labels Sep 26, 2024
@yyx990803 yyx990803 closed this in ea3efa0 Sep 27, 2024
@@ -95,7 +95,7 @@ export function patchDOMProp(
// some properties has getter, no setter, will error in 'use strict'
// eg. <select :type="null"></select> <select :willValidate="null"></select>
try {
el[key] = value
el[camelize(key)] = value
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't do it here as it affects all elements. This should only apply to Vue custom elements. See ea3efa0 (reused test from this PR)

@linzhe141 linzhe141 deleted the fix-patch-prop branch September 27, 2024 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: custom elements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boolean multi word property (kebab case) binding doesn't work
3 participants