MCPcopy
hub / github.com/flatpickr/flatpickr / destroy

Function destroy

src/index.ts:1374–1449  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1372 }
1373
1374 function destroy() {
1375 if (self.config !== undefined) triggerEvent("onDestroy");
1376
1377 for (let i = self._handlers.length; i--; ) {
1378 self._handlers[i].remove();
1379 }
1380
1381 self._handlers = [];
1382
1383 if (self.mobileInput) {
1384 if (self.mobileInput.parentNode)
1385 self.mobileInput.parentNode.removeChild(self.mobileInput);
1386 self.mobileInput = undefined;
1387 } else if (self.calendarContainer && self.calendarContainer.parentNode) {
1388 if (self.config.static && self.calendarContainer.parentNode) {
1389 const wrapper = self.calendarContainer.parentNode;
1390 wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
1391
1392 if (wrapper.parentNode) {
1393 while (wrapper.firstChild)
1394 wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
1395 wrapper.parentNode.removeChild(wrapper);
1396 }
1397 } else
1398 self.calendarContainer.parentNode.removeChild(self.calendarContainer);
1399 }
1400
1401 if (self.altInput) {
1402 self.input.type = "text";
1403 if (self.altInput.parentNode)
1404 self.altInput.parentNode.removeChild(self.altInput);
1405 delete self.altInput;
1406 }
1407
1408 if (self.input) {
1409 self.input.type = (self.input as any)._type;
1410 self.input.classList.remove("flatpickr-input");
1411 self.input.removeAttribute("readonly");
1412 }
1413
1414 ([
1415 "_showTimeInput",
1416 "latestSelectedDateObj",
1417 "_hideNextMonthArrow",
1418 "_hidePrevMonthArrow",
1419 "__hideNextMonthArrow",
1420 "__hidePrevMonthArrow",
1421 "isMobile",
1422 "isOpen",
1423 "selectedDateElem",
1424 "minDateHasTime",
1425 "maxDateHasTime",
1426 "days",
1427 "daysContainer",
1428 "_input",
1429 "_positionElement",
1430 "innerContainer",
1431 "rContainer",

Callers

nothing calls this directly

Calls 1

triggerEventFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…