MCPcopy
hub / github.com/reactjs/react-modal / withElementCollector

Function withElementCollector

specs/helper.js:63–76  ·  view source on GitHub ↗
(work)

Source from the content-addressed store, hash-verified

61 * all the elements (built with `createHTMLElement`) after a test.
62 */
63export function withElementCollector(work) {
64 let r;
65 let poolIndex = elementPool.length;
66 elementPool[poolIndex] = [];
67 try {
68 r = work();
69 } finally {
70 drainPool(elementPool[poolIndex]);
71 elementPool = elementPool.slice(
72 0, poolIndex
73 );
74 }
75 return r;
76}
77
78/**
79 * Polyfill for String.includes on some node versions.

Callers 3

Modal.spec.jsFile · 0.90
withModalFunction · 0.85

Calls 1

drainPoolFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…