]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-dom): ensure readonly type prop on textarea is handled patched as attribu...
authorThorsten Lünborg <t.luenborg@googlemail.com>
Wed, 24 Feb 2021 19:51:19 +0000 (20:51 +0100)
committerGitHub <noreply@github.com>
Wed, 24 Feb 2021 19:51:19 +0000 (14:51 -0500)
close #2766

Co-authored-by: Thorsten Luenborg <t.luneborg@googlemail.com>
packages/runtime-dom/__tests__/patchProps.spec.ts
packages/runtime-dom/src/patchProp.ts

index 962d55e882b78fb16e73a29783571a412fad2c1e..bec0f9ba3426e4823d96b68975f0fbabd3956db1 100644 (file)
@@ -149,4 +149,11 @@ describe('runtime-dom: props patching', () => {
     patchProp(el, 'form', 'foo', null)
     expect(el.getAttribute('form')).toBe(null)
   })
+
+  test('readonly type prop on textarea', () => {
+    const el = document.createElement('textarea')
+    // just to verify that it doesn't throw when i.e. switching a dynamic :is from an 'input' to a 'textarea'
+    // see https://github.com/vuejs/vue-next/issues/2766
+    patchProp(el, 'type', 'text', null)
+  })
 })
index 848ee160a8b023e8ba98475607e51dda4e38dcb7..6842b98c2b0f97e534c66ca96564413d500a115d 100644 (file)
@@ -115,5 +115,10 @@ function shouldSetAsProp(
     return false
   }
 
+  // DOMprop "type" is readonly on textarea elements: https://github.com/vuejs/vue-next/issues/2766
+  if (key === 'type' && el.tagName === 'TEXTAREA') {
+    return false
+  }
+
   return key in el
 }