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: patch translate as an attr #5485

Merged
merged 2 commits into from Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/runtime-dom/__tests__/patchProps.spec.ts
Expand Up @@ -263,4 +263,11 @@ describe('runtime-dom: props patching', () => {
)
expect(el.value).toBe('baz')
})

test('translate attribute', () => {
const el = document.createElement('div')
patchProp(el, 'translate', null, 'no')
expect(el.translate).toBeFalsy()
expect(el.getAttribute('translate')).toBe('no')
})
})
6 changes: 6 additions & 0 deletions packages/runtime-dom/src/patchProp.ts
Expand Up @@ -105,6 +105,12 @@ function shouldSetAsProp(
return false
}

// #5462 translate is an enumerated attr, however its
// corresponding DOM property are actually boolean.
if (key === 'translate') {
zhmushan marked this conversation as resolved.
Show resolved Hide resolved
return false
}

// native onclick with string value, must be set as attribute
if (nativeOnRE.test(key) && isString(value)) {
return false
Expand Down