Skip to content

Commit ab8bfac

Browse files
committed
chore: remove no longer used cloneNode implementation in nodeOps
1 parent aa70188 commit ab8bfac

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

packages/runtime-dom/__tests__/nodeOps.spec.ts

-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { nodeOps, svgNS } from '../src/nodeOps'
22

33
describe('runtime-dom: node-ops', () => {
4-
test('the _value property should be cloned', () => {
5-
const el = nodeOps.createElement('input') as HTMLDivElement & {
6-
_value: any
7-
}
8-
el._value = 1
9-
const cloned = nodeOps.cloneNode!(el) as HTMLDivElement & { _value: any }
10-
expect(cloned._value).toBe(1)
11-
})
12-
134
test("the <select>'s multiple attr should be set in createElement", () => {
145
const el = nodeOps.createElement('select', false, undefined, {
156
multiple: ''

packages/runtime-dom/src/nodeOps.ts

-17
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,6 @@ export const nodeOps: Omit<RendererOptions<Node, Element>, 'patchProp'> = {
5252
el.setAttribute(id, '')
5353
},
5454

55-
cloneNode(el) {
56-
const cloned = el.cloneNode(true)
57-
// #3072
58-
// - in `patchDOMProp`, we store the actual value in the `el._value` property.
59-
// - normally, elements using `:value` bindings will not be hoisted, but if
60-
// the bound value is a constant, e.g. `:value="true"` - they do get
61-
// hoisted.
62-
// - in production, hoisted nodes are cloned when subsequent inserts, but
63-
// cloneNode() does not copy the custom property we attached.
64-
// - This may need to account for other custom DOM properties we attach to
65-
// elements in addition to `_value` in the future.
66-
if (`_value` in el) {
67-
;(cloned as any)._value = (el as any)._value
68-
}
69-
return cloned
70-
},
71-
7255
// __UNSAFE__
7356
// Reason: innerHTML.
7457
// Static content here can only come from compiled templates.

0 commit comments

Comments
 (0)