* Sync the checked property of checkbox and radio elements, since cloneNode and innerHTML do not copy/preserve dynamic checked state. * @param {HTMLElement} $clone * @param {HTMLElement} $item
($clone, $item)
| 223 | * @param {HTMLElement} $item |
| 224 | */ |
| 225 | function syncCheckboxState($clone, $item) { |
| 226 | const $itemCheckbox = $item.querySelector( |
| 227 | 'input[type="checkbox"], input[type="radio"]', |
| 228 | ); |
| 229 | if ($itemCheckbox) { |
| 230 | const $cloneCheckbox = $clone.querySelector( |
| 231 | 'input[type="checkbox"], input[type="radio"]', |
| 232 | ); |
| 233 | if ($cloneCheckbox) { |
| 234 | $cloneCheckbox.checked = $itemCheckbox.checked; |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | export default searchBar; |
no outgoing calls
no test coverage detected