code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function memoizeProps(workInProgress, nextProps) { workInProgress.memoizedProps = nextProps; }
Warns if there is a duplicate or missing key
memoizeProps
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function memoizeState(workInProgress, nextState) { workInProgress.memoizedState = nextState; // Don't reset the updateQueue, in case there are pending updates. Resetting // is handled by beginUpdateQueue. }
Warns if there is a duplicate or missing key
memoizeState
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function beginWork(current, workInProgress, priorityLevel) { if (workInProgress.pendingWorkPriority === NoWork$3 || workInProgress.pendingWorkPriority > priorityLevel) { return bailoutOnLowPriority(current, workInProgress); } { ReactDebugCurrentFiber$4.setCurrentFiber(workInProgress, null); ...
Warns if there is a duplicate or missing key
beginWork
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
ReactFiberCompleteWork = function (config, hostContext, hydrationContext) { var createInstance = config.createInstance, createTextInstance = config.createTextInstance, appendInitialChild = config.appendInitialChild, finalizeInitialChildren = config.finalizeInitialChildren, prepareUpdate = conf...
Warns if there is a duplicate or missing key
ReactFiberCompleteWork
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function markUpdate(workInProgress) { // Tag the fiber with an update effect. This turns a Placement into // an UpdateAndPlacement. workInProgress.effectTag |= Update$2; }
Warns if there is a duplicate or missing key
markUpdate
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function markRef(workInProgress) { workInProgress.effectTag |= Ref$2; }
Warns if there is a duplicate or missing key
markRef
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function appendAllYields(yields, workInProgress) { var node = workInProgress.stateNode; if (node) { node['return'] = workInProgress; } while (node !== null) { if (node.tag === HostComponent$8 || node.tag === HostText$6 || node.tag === HostPortal$6) { invariant(false, 'A coroutine can...
Warns if there is a duplicate or missing key
appendAllYields
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function moveCoroutineToHandlerPhase(current, workInProgress) { var coroutine = workInProgress.memoizedProps; !coroutine ? invariant(false, 'Should be resolved by now. This error is likely caused by a bug in React. Please file an issue.') : void 0; // First step of the coroutine has completed. Now we need ...
Warns if there is a duplicate or missing key
moveCoroutineToHandlerPhase
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function appendAllChildren(parent, workInProgress) { // We only have the top Fiber that was created but we need recurse down its // children to find all the terminal nodes. var node = workInProgress.child; while (node !== null) { if (node.tag === HostComponent$8 || node.tag === HostText$6) { ...
Warns if there is a duplicate or missing key
appendAllChildren
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function completeWork(current, workInProgress, renderPriority) { { ReactDebugCurrentFiber$5.setCurrentFiber(workInProgress, null); } // Get the latest props. var newProps = workInProgress.pendingProps; if (newProps === null) { newProps = workInProgress.memoizedProps; } else if (work...
Warns if there is a duplicate or missing key
completeWork
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function catchErrors(fn) { return function (arg) { try { return fn(arg); } catch (err) { if (true && !hasLoggedError) { hasLoggedError = true; warning$26(false, 'React DevTools encountered an error: %s', err); } } }; }
Warns if there is a duplicate or missing key
catchErrors
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function injectInternals$1(internals) { if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { // No DevTools return false; } var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; if (!hook.supportsFiber) { { warning$26(false, 'The installed version of React DevTools is too old and will not work ' ...
Warns if there is a duplicate or missing key
injectInternals$1
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function onCommitRoot$1(root) { if (typeof onCommitFiberRoot === 'function') { onCommitFiberRoot(root); } }
Warns if there is a duplicate or missing key
onCommitRoot$1
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function onCommitUnmount$1(fiber) { if (typeof onCommitFiberUnmount === 'function') { onCommitFiberUnmount(fiber); } }
Warns if there is a duplicate or missing key
onCommitUnmount$1
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
ReactFiberCommitWork = function (config, captureError) { var commitMount = config.commitMount, commitUpdate = config.commitUpdate, resetTextContent = config.resetTextContent, commitTextUpdate = config.commitTextUpdate, appendChild = config.appendChild, appendChildToContainer = config.app...
Warns if there is a duplicate or missing key
ReactFiberCommitWork
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
callComponentWillUnmountWithTimerInDev = function (current, instance) { startPhaseTimer$2(current, 'componentWillUnmount'); instance.props = current.memoizedProps; instance.state = current.memoizedState; instance.componentWillUnmount(); stopPhaseTimer$2(); }
Warns if there is a duplicate or missing key
callComponentWillUnmountWithTimerInDev
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function safelyCallComponentWillUnmount(current, instance) { { invokeGuardedCallback$2(null, callComponentWillUnmountWithTimerInDev, null, current, instance); if (hasCaughtError$1()) { var unmountError = clearCaughtError$1(); captureError(current, unmountError); } } }
Warns if there is a duplicate or missing key
safelyCallComponentWillUnmount
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function safelyDetachRef(current) { var ref = current.ref; if (ref !== null) { { invokeGuardedCallback$2(null, ref, null, null); if (hasCaughtError$1()) { var refError = clearCaughtError$1(); captureError(current, refError); } } } }
Warns if there is a duplicate or missing key
safelyDetachRef
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getHostParentFiber(fiber) { var parent = fiber['return']; while (parent !== null) { if (isHostParent(parent)) { return parent; } parent = parent['return']; } invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an...
Warns if there is a duplicate or missing key
getHostParentFiber
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isHostParent(fiber) { return fiber.tag === HostComponent$9 || fiber.tag === HostRoot$9 || fiber.tag === HostPortal$7; }
Warns if there is a duplicate or missing key
isHostParent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getHostSibling(fiber) { // We're going to search forward into the tree until we find a sibling host // node. Unfortunately, if multiple insertions are done in a row we have to // search past them. This leads to exponential search for the next sibling. var node = fiber; siblings: while (true...
Warns if there is a duplicate or missing key
getHostSibling
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitPlacement(finishedWork) { // Recursively insert all host nodes into the parent. var parentFiber = getHostParentFiber(finishedWork); var parent = void 0; var isContainer = void 0; switch (parentFiber.tag) { case HostComponent$9: parent = parentFiber.stateNode; isC...
Warns if there is a duplicate or missing key
commitPlacement
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitNestedUnmounts(root) { // While we're inside a removed host node we don't want to call // removeChild on the inner nodes because they're removed by the top // call anyway. We also want to call componentWillUnmount on all // composites before this host node is removed from the tree. Theref...
Warns if there is a duplicate or missing key
commitNestedUnmounts
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function unmountHostComponents(current) { // We only have the top Fiber that was inserted but we need recurse down its var node = current; // Each iteration, currentParent is populated with node's host parent if not // currentParentIsValid. var currentParentIsValid = false; var currentParent = ...
Warns if there is a duplicate or missing key
unmountHostComponents
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitDeletion(current) { // Recursively delete all host nodes from the parent. // Detach refs and call componentWillUnmount() on the whole subtree. unmountHostComponents(current); // Cut off the return pointers to disconnect it from the tree. Ideally, we // should clear the child pointer ...
Warns if there is a duplicate or missing key
commitDeletion
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitUnmount(current) { if (typeof onCommitUnmount === 'function') { onCommitUnmount(current); } switch (current.tag) { case ClassComponent$9: { safelyDetachRef(current); var instance = current.stateNode; if (typeof instance.componentWillUnmount =...
Warns if there is a duplicate or missing key
commitUnmount
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitWork(current, finishedWork) { switch (finishedWork.tag) { case ClassComponent$9: { return; } case HostComponent$9: { var instance = finishedWork.stateNode; if (instance != null) { // Commit the work prepared earlier. ...
Warns if there is a duplicate or missing key
commitWork
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitLifeCycles(current, finishedWork) { switch (finishedWork.tag) { case ClassComponent$9: { var instance = finishedWork.stateNode; if (finishedWork.effectTag & Update$3) { if (current === null) { { startPhaseTimer$2(finishedWork...
Warns if there is a duplicate or missing key
commitLifeCycles
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitAttachRef(finishedWork) { var ref = finishedWork.ref; if (ref !== null) { var instance = finishedWork.stateNode; switch (finishedWork.tag) { case HostComponent$9: ref(getPublicInstance(instance)); break; default: ref(instance); } ...
Warns if there is a duplicate or missing key
commitAttachRef
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function commitDetachRef(current) { var currentRef = current.ref; if (currentRef !== null) { currentRef(null); } }
Warns if there is a duplicate or missing key
commitDetachRef
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
ReactFiberHostContext = function (config) { var getChildHostContext = config.getChildHostContext, getRootHostContext = config.getRootHostContext; var contextStackCursor = createCursor$2(NO_CONTEXT); var contextFiberStackCursor = createCursor$2(NO_CONTEXT); var rootInstanceStackCursor = createCursor$2(NO...
Warns if there is a duplicate or missing key
ReactFiberHostContext
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function requiredContext(c) { !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0; return c; }
Warns if there is a duplicate or missing key
requiredContext
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getRootHostContainer() { var rootInstance = requiredContext(rootInstanceStackCursor.current); return rootInstance; }
Warns if there is a duplicate or missing key
getRootHostContainer
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function pushHostContainer(fiber, nextRootInstance) { // Push current root instance onto the stack; // This allows us to reset root when portals are popped. push$2(rootInstanceStackCursor, nextRootInstance, fiber); var nextRootContext = getRootHostContext(nextRootInstance); // Track the context an...
Warns if there is a duplicate or missing key
pushHostContainer
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function popHostContainer(fiber) { pop$2(contextStackCursor, fiber); pop$2(contextFiberStackCursor, fiber); pop$2(rootInstanceStackCursor, fiber); }
Warns if there is a duplicate or missing key
popHostContainer
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getHostContext() { var context = requiredContext(contextStackCursor.current); return context; }
Warns if there is a duplicate or missing key
getHostContext
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function pushHostContext(fiber) { var rootInstance = requiredContext(rootInstanceStackCursor.current); var context = requiredContext(contextStackCursor.current); var nextContext = getChildHostContext(context, fiber.type, rootInstance); // Don't push this Fiber's context unless it's unique. if (cont...
Warns if there is a duplicate or missing key
pushHostContext
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function popHostContext(fiber) { // Do not pop unless this Fiber provided the current context. // pushHostContext() only pushes Fibers that provide unique contexts. if (contextFiberStackCursor.current !== fiber) { return; } pop$2(contextStackCursor, fiber); pop$2(contextFiberStackCursor, ...
Warns if there is a duplicate or missing key
popHostContext
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function resetHostContainer() { contextStackCursor.current = NO_CONTEXT; rootInstanceStackCursor.current = NO_CONTEXT; }
Warns if there is a duplicate or missing key
resetHostContainer
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
ReactFiberHydrationContext = function (config) { var shouldSetTextContent = config.shouldSetTextContent, canHydrateInstance = config.canHydrateInstance, canHydrateTextInstance = config.canHydrateTextInstance, getNextHydratableSibling = config.getNextHydratableSibling, getFirstHydratableChild =...
Warns if there is a duplicate or missing key
ReactFiberHydrationContext
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function enterHydrationState(fiber) { var parentInstance = fiber.stateNode.containerInfo; nextHydratableInstance = getFirstHydratableChild(parentInstance); hydrationParentFiber = fiber; isHydrating = true; return true; }
Warns if there is a duplicate or missing key
enterHydrationState
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function deleteHydratableInstance(returnFiber, instance) { { switch (returnFiber.tag) { case HostRoot$10: didNotHydrateInstance(returnFiber.stateNode.containerInfo, instance); break; case HostComponent$10: didNotHydrateInstance(returnFiber.stateNode, instance); ...
Warns if there is a duplicate or missing key
deleteHydratableInstance
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function insertNonHydratedInstance(returnFiber, fiber) { fiber.effectTag |= Placement$6; { var parentInstance; switch (returnFiber.tag) { // TODO: Currently we don't warn for insertions into the root because // we always insert into the root in the non-hydrating case. We just ...
Warns if there is a duplicate or missing key
insertNonHydratedInstance
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function canHydrate(fiber, nextInstance) { switch (fiber.tag) { case HostComponent$10: { var type = fiber.type; var props = fiber.pendingProps; return canHydrateInstance(nextInstance, type, props); } case HostText$8: { var text = fiber.pend...
Warns if there is a duplicate or missing key
canHydrate
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function tryToClaimNextHydratableInstance(fiber) { if (!isHydrating) { return; } var nextInstance = nextHydratableInstance; if (!nextInstance) { // Nothing to hydrate. Make it an insertion. insertNonHydratedInstance(hydrationParentFiber, fiber); isHydrating = false; hydrati...
Warns if there is a duplicate or missing key
tryToClaimNextHydratableInstance
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { var instance = fiber.stateNode; var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber); // TODO: Type this specific to this type of component. fiber.updat...
Warns if there is a duplicate or missing key
prepareToHydrateHostInstance
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function prepareToHydrateHostTextInstance(fiber) { var textInstance = fiber.stateNode; var shouldUpdate = hydrateTextInstance(textInstance, fiber.memoizedProps, fiber); return shouldUpdate; }
Warns if there is a duplicate or missing key
prepareToHydrateHostTextInstance
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function popToNextHostParent(fiber) { var parent = fiber['return']; while (parent !== null && parent.tag !== HostComponent$10 && parent.tag !== HostRoot$10) { parent = parent['return']; } hydrationParentFiber = parent; }
Warns if there is a duplicate or missing key
popToNextHostParent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function popHydrationState(fiber) { if (fiber !== hydrationParentFiber) { // We're deeper than the current hydration context, inside an inserted // tree. return false; } if (!isHydrating) { // If we're not currently hydrating but we're in a hydration context, then // we were an...
Warns if there is a duplicate or missing key
popHydrationState
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function resetHydrationState() { hydrationParentFiber = null; nextHydratableInstance = null; isHydrating = false; }
Warns if there is a duplicate or missing key
resetHydrationState
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getLeafNode(node) { while (node && node.firstChild) { node = node.firstChild; } return node; }
Given any node return the first leaf node without children. @param {DOMElement|DOMTextNode} node @return {DOMElement|DOMTextNode}
getLeafNode
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getSiblingNode(node) { while (node) { if (node.nextSibling) { return node.nextSibling; } node = node.parentNode; } }
Get the next sibling within a container. This will walk up the DOM if a node's siblings have been exhausted. @param {DOMElement|DOMTextNode} node @return {?DOMElement|DOMTextNode}
getSiblingNode
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getNodeForCharacterOffset(root, offset) { var node = getLeafNode(root); var nodeStart = 0; var nodeEnd = 0; while (node) { if (node.nodeType === TEXT_NODE$3) { nodeEnd = nodeStart + node.textContent.length; if (nodeStart <= offset && nodeEnd >= offset) { return { nod...
Get object describing the nodes which contain characters at offset. @param {DOMElement|DOMTextNode} root @param {number} offset @return {?object}
getNodeForCharacterOffset
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getTextContentAccessor() { if (!contentKey && ExecutionEnvironment.canUseDOM) { // Prefer textContent to innerText because many browsers support both but // SVG <text> elements don't support innerText even when <div> does. contentKey = 'textContent' in document.documentElement ? 'textContent' : '...
Gets the key used to access text content on a DOM node. @return {?string} Key used to access text content. @internal
getTextContentAccessor
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isCollapsed(anchorNode, anchorOffset, focusNode$$1, focusOffset) { return anchorNode === focusNode$$1 && anchorOffset === focusOffset; }
While `isCollapsed` is available on the Selection object and `collapsed` is available on the Range object, IE11 sometimes gets them wrong. If the anchor/focus nodes and offsets are the same, the range is collapsed.
isCollapsed
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function setModernOffsets(node, offsets) { if (!window.getSelection) { return; } var selection = window.getSelection(); var length = node[getTextContentAccessor_1()].length; var start = Math.min(offsets.start, length); var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // I...
In modern non-IE browsers, we can support both forward and backward selections. Note: IE10+ supports the Selection object, but it does not support the `extend` method, which means that even in modern IE, it's not possible to programmatically create a backward selection. Thus, for all IE versions, we use the old IE API...
setModernOffsets
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isInDocument(node) { return containsNode(document.documentElement, node); }
@param {DOMElement|DOMTextNode} node @param {object} offsets
isInDocument
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
printWarning = function (format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; });...
Forked from fbjs/warning: https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js Only change is we use console.warn instead of console.error, and do nothing when 'console' is not supported. This really simplifies the code. --- Similar to invariant but only...
printWarning
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
updatedAncestorInfo$1 = function (oldInfo, tag, instance) { var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); var info = { tag: tag, instance: instance }; if (inScopeTags.indexOf(tag) !== -1) { ancestorInfo.aTagInScope = null; ancestorInfo.buttonTagInScope = null; ancestorInfo...
Forked from fbjs/warning: https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js Only change is we use console.warn instead of console.error, and do nothing when 'console' is not supported. This really simplifies the code. --- Similar to invariant but only...
updatedAncestorInfo$1
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
findOwnerStack = function (instance) { if (!instance) { return []; } var stack = []; do { stack.push(instance); } while (instance = instance._currentElement._owner); stack.reverse(); return stack; }
Given a ReactCompositeComponent instance, return a list of its recursive owners, starting at the root and ending with the instance itself.
findOwnerStack
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
getOwnerInfo = function (childInstance, childTag, ancestorInstance, ancestorTag, isParent) { var childOwner = childInstance && childInstance._currentElement._owner; var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; var childOwners = findOwnerStack(childOwner); var ancesto...
Given a ReactCompositeComponent instance, return a list of its recursive owners, starting at the root and ending with the instance itself.
getOwnerInfo
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getParent(inst) { if (inst._hostParent !== undefined) { return inst._hostParent; } if (typeof inst.tag === 'number') { do { inst = inst['return']; // TODO: If this is a HostRoot we might want to bail out. // That is depending on if we want nested subtrees (layers) to bubble ...
Given a ReactCompositeComponent instance, return a list of its recursive owners, starting at the root and ending with the instance itself.
getParent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getLowestCommonAncestor(instA, instB) { var depthA = 0; for (var tempA = instA; tempA; tempA = getParent(tempA)) { depthA++; } var depthB = 0; for (var tempB = instB; tempB; tempB = getParent(tempB)) { depthB++; } // If A is deeper, crawl up. while (depthA - depthB > 0) { instA = g...
Return the lowest common ancestor of A and B, or null if they are in different trees.
getLowestCommonAncestor
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isAncestor(instA, instB) { while (instB) { if (instA === instB || instA === instB.alternate) { return true; } instB = getParent(instB); } return false; }
Return if A is an ancestor of B.
isAncestor
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getParentInstance(inst) { return getParent(inst); }
Return the parent instance of the passed-in instance.
getParentInstance
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function traverseTwoPhase(inst, fn, arg) { var path = []; while (inst) { path.push(inst); inst = getParent(inst); } var i; for (i = path.length; i-- > 0;) { fn(path[i], 'captured', arg); } for (i = 0; i < path.length; i++) { fn(path[i], 'bubbled', arg); } }
Simulates the traversal of a two-phase, capture/bubble event dispatch.
traverseTwoPhase
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function traverseEnterLeave(from, to, fn, argFrom, argTo) { var common = from && to ? getLowestCommonAncestor(from, to) : null; var pathFrom = []; while (from && from !== common) { pathFrom.push(from); from = getParent(from); } var pathTo = []; while (to && to !== common) { pathTo.push(to); ...
Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that should would receive a `mouseEnter` or `mouseLeave` event. Does not invoke the callback on the nearest common ancestor because nothing "entered" or "left" that element.
traverseEnterLeave
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function listenerAtPhase(inst, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(inst, registrationName); }
Some event types have a notion of different registration names for different "phases" of propagation. This finds listeners by a given phase.
listenerAtPhase
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateDirectionalDispatches(inst, phase, event) { { warning$29(inst, 'Dispatching inst must not be null'); } var listener = listenerAtPhase(inst, event, phase); if (listener) { event._dispatchListeners = accumulateInto_1(event._dispatchListeners, listener); event._dispatchInstances = ac...
Tags a `SyntheticEvent` with dispatched listeners. Creating this function here, allows us to not have to bind or create functions for each event. Mutating the event's members allows us to not have to create a wrapping "dispatch" object that pairs the event with the listener.
accumulateDirectionalDispatches
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { ReactTreeTraversal.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); } }
Collect dispatches (must be entirely collected before dispatching - see unit tests). Lazily allocate the array to conserve memory. We must loop through each event and perform the traversal for each one. We cannot perform a single traversal for the entire collection of events because each event may have a different tar...
accumulateTwoPhaseDispatchesSingle
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { var targetInst = event._targetInst; var parentInst = targetInst ? ReactTreeTraversal.getParentInstance(targetInst) : null; ReactTreeTraversal.traverseTwoPhase(parentInst, accumulateD...
Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
accumulateTwoPhaseDispatchesSingleSkipTarget
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateDispatches(inst, ignoredDirection, event) { if (inst && event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(inst, registrationName); if (listener) { event._dispatchListeners = accumulateInto_1(e...
Accumulates without regard to direction, does not look for phased registration names. Same as `accumulateDirectDispatchesSingle` but without requiring that the `dispatchMarker` be the same as the dispatched ID.
accumulateDispatches
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateDirectDispatchesSingle(event) { if (event && event.dispatchConfig.registrationName) { accumulateDispatches(event._targetInst, null, event); } }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateDirectDispatchesSingle
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateTwoPhaseDispatches(events) { forEachAccumulated_1(events, accumulateTwoPhaseDispatchesSingle); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateTwoPhaseDispatches
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateTwoPhaseDispatchesSkipTarget(events) { forEachAccumulated_1(events, accumulateTwoPhaseDispatchesSingleSkipTarget); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateTwoPhaseDispatchesSkipTarget
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateEnterLeaveDispatches(leave, enter, from, to) { ReactTreeTraversal.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateEnterLeaveDispatches
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function accumulateDirectDispatches(events) { forEachAccumulated_1(events, accumulateDirectDispatchesSingle); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateDirectDispatches
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { { // these have a getter/setter for warnings delete this.nativeEvent; delete this.preventDefault; delete this.stopPropagation; } this.dispatchConfig = dispatchConfig; this._targetInst = targetInst; this.nati...
Synthetic events are dispatched by event plugins, typically in response to a top-level event delegation handler. These systems should generally use pooling to reduce the frequency of garbage collection. The system should check `isPersistent` to determine whether the event should be released into the pool after being d...
SyntheticEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getPooledWarningPropertyDefinition(propName, getVal) { var isFunction = typeof getVal === 'function'; return { configurable: true, set: set, get: get }; function set(val) { var action = isFunction ? 'setting the method' : 'setting the property'; warn(action, 'This is effectively a ...
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
getPooledWarningPropertyDefinition
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function set(val) { var action = isFunction ? 'setting the method' : 'setting the property'; warn(action, 'This is effectively a no-op'); return val; }
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
set
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function get() { var action = isFunction ? 'accessing the method' : 'accessing the property'; var result = isFunction ? 'This is a no-op function' : 'This is set to null'; warn(action, result); return getVal; }
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
get
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function warn(action, result) { var warningCondition = false; warning$30(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist...
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
warn
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { var EventConstructor = this; if (EventConstructor.eventPool.length) { var instance = EventConstructor.eventPool.pop(); EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); return instance; }...
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
getPooledEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function releasePooledEvent(event) { var EventConstructor = this; !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0; event.destructor(); if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { EventConstructor.eventPo...
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
releasePooledEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function addEventPoolingTo(EventConstructor) { EventConstructor.eventPool = []; EventConstructor.getPooled = getPooledEvent; EventConstructor.release = releasePooledEvent; }
Helper to nullify syntheticEvent instance properties when destructing @param {String} propName @param {?object} getVal @return {object} defineProperty object
addEventPoolingTo
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticEvent_1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); }
@param {object} dispatchConfig Configuration used to dispatch this event. @param {string} dispatchMarker Marker identifying the event target. @param {object} nativeEvent Native browser event. @extends {SyntheticUIEvent}
SyntheticCompositionEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticEvent_1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); }
@param {object} dispatchConfig Configuration used to dispatch this event. @param {string} dispatchMarker Marker identifying the event target. @param {object} nativeEvent Native browser event. @extends {SyntheticUIEvent}
SyntheticInputEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isPresto() { var opera = window.opera; return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; }
Opera <= 12 includes TextEvent in window, but does not fire text input events. Rely on keypress instead.
isPresto
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isKeypressCommand(nativeEvent) { return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey); }
Return whether a native keypress event is assumed to be a command. This is required because Firefox fires `keypress` events for key commands (cut, copy, select-all, etc.) even though no character is inserted.
isKeypressCommand
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getCompositionEventType(topLevelType) { switch (topLevelType) { case 'topCompositionStart': return eventTypes.compositionStart; case 'topCompositionEnd': return eventTypes.compositionEnd; case 'topCompositionUpdate': return eventTypes.compositionUpdate; } }
Translate native top level events into event types. @param {string} topLevelType @return {object}
getCompositionEventType
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isFallbackCompositionStart(topLevelType, nativeEvent) { return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; }
Does our fallback best-guess model think this event signifies that composition has begun? @param {string} topLevelType @param {object} nativeEvent @return {boolean}
isFallbackCompositionStart
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isFallbackCompositionEnd(topLevelType, nativeEvent) { switch (topLevelType) { case 'topKeyUp': // Command keys insert or clear IME input. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; case 'topKeyDown': // Expect IME keyCode on each keydown. If we get any other // c...
Does our fallback mode think that this event is the end of composition? @param {string} topLevelType @param {object} nativeEvent @return {boolean}
isFallbackCompositionEnd
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getDataFromCustomEvent(nativeEvent) { var detail = nativeEvent.detail; if (typeof detail === 'object' && 'data' in detail) { return detail.data; } return null; }
Google Input Tools provides composition data via a CustomEvent, with the `data` property populated in the `detail` object. If this is available on the event object, use it. If not, this is a plain composition event and we have nothing special to extract. @param {object} nativeEvent @return {?string}
getDataFromCustomEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getNativeBeforeInputChars(topLevelType, nativeEvent) { switch (topLevelType) { case 'topCompositionEnd': return getDataFromCustomEvent(nativeEvent); case 'topKeyPress': /** * If native `textInput` events are available, our goal is to make * use of them. However, there is a s...
@param {TopLevelTypes} topLevelType Record from `BrowserEventConstants`. @param {object} nativeEvent Native browser event. @return {?string} The string corresponding to this `beforeInput` event.
getNativeBeforeInputChars
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function getFallbackBeforeInputChars(topLevelType, nativeEvent) { // If we are currently composing (IME) and using a fallback to do so, // try to extract the composed characters from the fallback object. // If composition event is available, we extract a string only at // compositionevent, otherwise extract it ...
For browsers that do not provide the `textInput` event, extract the appropriate string to use for SyntheticInputEvent. @param {string} topLevelType Record from `BrowserEventConstants`. @param {object} nativeEvent Native browser event. @return {?string} The fallback string for this `beforeInput` event.
getFallbackBeforeInputChars
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var chars; if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(topLevelType, nativeEvent); } else { chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } // If no characters are being i...
Extract a SyntheticInputEvent for `beforeInput`, based on either native `textInput` or fallback behavior. @return {?object} A SyntheticInputEvent.
extractBeforeInputEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function isTextInputElement(elem) { var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); if (nodeName === 'input') { return !!supportedInputTypes[elem.type]; } if (nodeName === 'textarea') { return true; } return false; }
@see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
isTextInputElement
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function createAndAccumulateChangeEvent(inst, nativeEvent, target) { var event = SyntheticEvent_1.getPooled(eventTypes$1.change, inst, nativeEvent, target); event.type = 'change'; // Flag this event loop as needing state restore. ReactControlledComponent_1.enqueueStateRestore(target); EventPropagators_1.accum...
@see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
createAndAccumulateChangeEvent
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function startWatchingForValueChange(target, targetInst) { activeElement = target; activeElementInst = targetInst; activeElement.attachEvent('onpropertychange', handlePropertyChange); }
(For IE <=9) Starts tracking propertychange events on the passed-in element and override the value property so that we can distinguish user events from value changes in JS.
startWatchingForValueChange
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT
function stopWatchingForValueChange() { if (!activeElement) { return; } activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementInst = null; }
(For IE <=9) Removes the event listeners from the currently-tracked element, if any exists.
stopWatchingForValueChange
javascript
agermanidis/livepython
dist/variable_inspector.js
https://github.com/agermanidis/livepython/blob/master/dist/variable_inspector.js
MIT