MCPcopy Create free account
hub / github.com/angular/components / transferInputData

Function transferInputData

src/cdk/drag-drop/dom/clone-node.ts:55–70  ·  view source on GitHub ↗

Transfers the data of one input element to another.

(
  source: Element & {value: string},
  clone: Element & {value: string; name: string; type: string},
)

Source from the content-addressed store, hash-verified

53
54/** Transfers the data of one input element to another. */
55function transferInputData(
56 source: Element & {value: string},
57 clone: Element & {value: string; name: string; type: string},
58) {
59 // Browsers throw an error when assigning the value of a file input programmatically.
60 if (clone.type !== 'file') {
61 clone.value = source.value;
62 }
63
64 // Radio button `name` attributes must be unique for radio button groups
65 // otherwise original radio buttons can lose their checked state
66 // once the clone is inserted in the DOM.
67 if (clone.type === 'radio' && clone.name) {
68 clone.name = `mat-clone-${clone.name}-${cloneUniqueId++}`;
69 }
70}
71
72/** Transfers the data of one canvas element to another. */
73function transferCanvasData(source: HTMLCanvasElement, clone: HTMLCanvasElement) {

Callers 1

deepCloneNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected