MCPcopy
hub / github.com/bubkoo/html-to-image / cloneSelectValue

Function cloneSelectValue

src/clone-node.ts:176–187  ·  view source on GitHub ↗
(nativeNode: T, clonedNode: T)

Source from the content-addressed store, hash-verified

174}
175
176function cloneSelectValue<T extends HTMLElement>(nativeNode: T, clonedNode: T) {
177 if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
178 const clonedSelect = clonedNode as any as HTMLSelectElement
179 const selectedOption = Array.from(clonedSelect.children).find(
180 (child) => nativeNode.value === child.getAttribute('value'),
181 )
182
183 if (selectedOption) {
184 selectedOption.setAttribute('selected', '')
185 }
186 }
187}
188
189function decorate<T extends HTMLElement>(
190 nativeNode: T,

Callers 1

decorateFunction · 0.85

Calls 1

isInstanceOfElementFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…