MCPcopy Index your code
hub / github.com/caseywebdev/react-list / commitBeforeMutationEffects

Function commitBeforeMutationEffects

docs/index.js:11218–11374  ·  view source on GitHub ↗
(root, firstChild)

Source from the content-addressed store, hash-verified

11216 nextEffect = null,
11217 shouldFireAfterActiveInstanceBlur = !1;
11218function commitBeforeMutationEffects(root, firstChild) {
11219 root = root.containerInfo;
11220 eventsEnabled = _enabled;
11221 root = getActiveElementDeep(root);
11222 if (hasSelectionCapabilities(root)) {
11223 if ("selectionStart" in root)
11224 var JSCompiler_temp = {
11225 start: root.selectionStart,
11226 end: root.selectionEnd
11227 };
11228 else
11229 a: {
11230 JSCompiler_temp =
11231 ((JSCompiler_temp = root.ownerDocument) &&
11232 JSCompiler_temp.defaultView) ||
11233 window;
11234 var selection =
11235 JSCompiler_temp.getSelection && JSCompiler_temp.getSelection();
11236 if (selection && 0 !== selection.rangeCount) {
11237 JSCompiler_temp = selection.anchorNode;
11238 var anchorOffset = selection.anchorOffset,
11239 focusNode = selection.focusNode;
11240 selection = selection.focusOffset;
11241 try {
11242 JSCompiler_temp.nodeType, focusNode.nodeType;
11243 } catch (e$20) {
11244 JSCompiler_temp = null;
11245 break a;
11246 }
11247 var length = 0,
11248 start = -1,
11249 end = -1,
11250 indexWithinAnchor = 0,
11251 indexWithinFocus = 0,
11252 node = root,
11253 parentNode = null;
11254 b: for (;;) {
11255 for (var next; ; ) {
11256 node !== JSCompiler_temp ||
11257 (0 !== anchorOffset && 3 !== node.nodeType) ||
11258 (start = length + anchorOffset);
11259 node !== focusNode ||
11260 (0 !== selection && 3 !== node.nodeType) ||
11261 (end = length + selection);
11262 3 === node.nodeType && (length += node.nodeValue.length);
11263 if (null === (next = node.firstChild)) break;
11264 parentNode = node;
11265 node = next;
11266 }
11267 for (;;) {
11268 if (node === root) break b;
11269 parentNode === JSCompiler_temp &&
11270 ++indexWithinAnchor === anchorOffset &&
11271 (start = length);
11272 parentNode === focusNode &&
11273 ++indexWithinFocus === selection &&
11274 (end = length);
11275 if (null !== (next = node.nextSibling)) break;

Callers 1

commitRootImplFunction · 0.85

Calls 7

getActiveElementDeepFunction · 0.85
hasSelectionCapabilitiesFunction · 0.85
captureCommitPhaseErrorFunction · 0.85
clearContainerSparinglyFunction · 0.85
formatProdErrorMessageFunction · 0.85
commitClassSnapshotFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…