]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: remove no longer used cloneNode implementation in nodeOps
authorEvan You <yyx990803@gmail.com>
Tue, 27 Sep 2022 07:50:26 +0000 (15:50 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 27 Sep 2022 08:17:14 +0000 (16:17 +0800)
packages/runtime-dom/__tests__/nodeOps.spec.ts
packages/runtime-dom/src/nodeOps.ts

index dcab9a0a6b9c03b9438d4c4de528378567f8b1ed..2573974c95531a513d7cd80b540c72864c3090c3 100644 (file)
@@ -1,15 +1,6 @@
 import { nodeOps, svgNS } from '../src/nodeOps'
 
 describe('runtime-dom: node-ops', () => {
-  test('the _value property should be cloned', () => {
-    const el = nodeOps.createElement('input') as HTMLDivElement & {
-      _value: any
-    }
-    el._value = 1
-    const cloned = nodeOps.cloneNode!(el) as HTMLDivElement & { _value: any }
-    expect(cloned._value).toBe(1)
-  })
-
   test("the <select>'s multiple attr should be set in createElement", () => {
     const el = nodeOps.createElement('select', false, undefined, {
       multiple: ''
index c03bda4e31ac3f505d3761a4f97ebf1741f4ec9f..daf56fc6f3aea9e43117d325630adc27edd4b10f 100644 (file)
@@ -52,23 +52,6 @@ export const nodeOps: Omit<RendererOptions<Node, Element>, 'patchProp'> = {
     el.setAttribute(id, '')
   },
 
-  cloneNode(el) {
-    const cloned = el.cloneNode(true)
-    // #3072
-    // - in `patchDOMProp`, we store the actual value in the `el._value` property.
-    // - normally, elements using `:value` bindings will not be hoisted, but if
-    //   the bound value is a constant, e.g. `:value="true"` - they do get
-    //   hoisted.
-    // - in production, hoisted nodes are cloned when subsequent inserts, but
-    //   cloneNode() does not copy the custom property we attached.
-    // - This may need to account for other custom DOM properties we attach to
-    //   elements in addition to `_value` in the future.
-    if (`_value` in el) {
-      ;(cloned as any)._value = (el as any)._value
-    }
-    return cloned
-  },
-
   // __UNSAFE__
   // Reason: innerHTML.
   // Static content here can only come from compiled templates.