@felte/core
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -197,2 +197,26 @@ import { isFormControl, getFormDefaultValues, _merge, _cloneDeep, debounce, _defaultsDeep, _get, getPath, isSelectElement, shouldIgnore, getInputTextOrNumber, _set, isInputElement, _isPlainObject, _unset, isElement, getFormControls } from '@felte/common'; | ||
}, 0); | ||
function handleNodeAddition(mutation) { | ||
const shouldUpdate = Array.from(mutation.addedNodes).some((node) => { | ||
if (!isElement(node)) | ||
return false; | ||
if (isFormControl(node)) | ||
return true; | ||
const formControls = getFormControls(node); | ||
return formControls.length > 0; | ||
}); | ||
if (!shouldUpdate) | ||
return; | ||
updateAddedNodes(); | ||
} | ||
function handleNodeRemoval(mutation) { | ||
for (const removedNode of mutation.removedNodes) { | ||
if (!isElement(removedNode)) | ||
continue; | ||
const formControls = getFormControls(removedNode); | ||
if (formControls.length === 0) | ||
continue; | ||
removedFormControls.push(...formControls); | ||
updateRemovedNodes(); | ||
} | ||
} | ||
function mutationCallback(mutationList) { | ||
@@ -202,26 +226,6 @@ for (const mutation of mutationList) { | ||
continue; | ||
if (mutation.addedNodes.length > 0) { | ||
const shouldUpdate = Array.from(mutation.addedNodes).some((node) => { | ||
if (!isElement(node)) | ||
return false; | ||
if (isFormControl(node)) | ||
return true; | ||
const formControls = getFormControls(node); | ||
return formControls.length > 0; | ||
}); | ||
if (!shouldUpdate) | ||
continue; | ||
updateAddedNodes(); | ||
} | ||
if (mutation.removedNodes.length > 0) { | ||
for (const removedNode of mutation.removedNodes) { | ||
if (!isElement(removedNode)) | ||
continue; | ||
const formControls = getFormControls(removedNode); | ||
if (formControls.length === 0) | ||
continue; | ||
removedFormControls.push(...formControls); | ||
updateRemovedNodes(); | ||
} | ||
} | ||
if (mutation.addedNodes.length > 0) | ||
handleNodeAddition(mutation); | ||
if (mutation.removedNodes.length > 0) | ||
handleNodeRemoval(mutation); | ||
} | ||
@@ -228,0 +232,0 @@ } |
{ | ||
"name": "@felte/core", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Core utility for Felte's integration with front-end frameworks", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347752
2826