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
static _jQueryInterface(config, relatedTarget) { return this.each(function () { let data = $(this).data(DATA_KEY) const _config = { ...Default, ...$(this).data(), ...(typeof config === 'object' && config ? config : {}) } if (!data) { data = new Modal(this, _c...
`document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` Do not move `document` in `htmlElements` array It will remove `EVENT_CLICK_DATA_API` event that should remain
_jQueryInterface
javascript
MahdiMajidzadeh/bootstrap-v4-rtl
js/src/modal.js
https://github.com/MahdiMajidzadeh/bootstrap-v4-rtl/blob/master/js/src/modal.js
MIT
function allowedAttribute(attr, allowedAttributeList) { const attrName = attr.nodeName.toLowerCase() if (allowedAttributeList.indexOf(attrName) !== -1) { if (uriAttrs.indexOf(attrName) !== -1) { return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)) } retu...
A pattern that matches safe data URLs. Only matches image, video and audio types. Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
allowedAttribute
javascript
MahdiMajidzadeh/bootstrap-v4-rtl
js/src/tools/sanitizer.js
https://github.com/MahdiMajidzadeh/bootstrap-v4-rtl/blob/master/js/src/tools/sanitizer.js
MIT
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { if (unsafeHtml.length === 0) { return unsafeHtml } if (sanitizeFn && typeof sanitizeFn === 'function') { return sanitizeFn(unsafeHtml) } const domParser = new window.DOMParser() const createdDocument = domParser.parseFromString(unsafeHtml,...
A pattern that matches safe data URLs. Only matches image, video and audio types. Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
sanitizeHtml
javascript
MahdiMajidzadeh/bootstrap-v4-rtl
js/src/tools/sanitizer.js
https://github.com/MahdiMajidzadeh/bootstrap-v4-rtl/blob/master/js/src/tools/sanitizer.js
MIT
findOverride = function(pkg) { return _(overrides).find(function(override, override_key) { return packageMatcher.matches(pkg, override_key); }); }
@param bowerComponents - output of 'bower list' command @param overrides - overrides coming from 'bower.json' @returns assets grouped by component and type
findOverride
javascript
yatskevich/grunt-bower-task
tasks/lib/bower_assets.js
https://github.com/yatskevich/grunt-bower-task/blob/master/tasks/lib/bower_assets.js
MIT
function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } els...
Use invariant() to assert state which your program assumes to be true. Provide sprintf-style format (only %s is supported) and arguments to provide information about what broke and what you were expecting. The invariant message will be stripped in production, but the invariant will remain to ensure logic does not dif...
invariant
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
printWarning = function printWarning(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...
Similar to invariant but only logs a warning if the condition is not met. This can be used to log issues in development environments in critical paths. Removing the logging code for production environments will keep the same logic and follow the same code paths.
printWarning
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function checkPropTypes(typeSpecs, values, location, componentName, getStack) { if (process.env.NODE_ENV !== 'production') { for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to ...
Assert that the values match with the type specs. Error messages are memorized and will only be shown once. @param {object} typeSpecs Map of name to a ReactPropType @param {object} values Runtime values that need to be type-checked @param {string} location e.g. "prop", "context", "child context" @param {string} compon...
checkPropTypes
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function shallowEqual(objA, objB) { if (is(objA, objB)) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return fa...
Performs equality by iterating through keys on an object and returning false when any key has values which are not strictly equal between the arguments. Returns true when the values of all keys are strictly equal.
shallowEqual
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); } else if (...
Checks if a given DOM node contains or is another DOM node.
containsNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function focusNode(node) { // IE8 can throw "Can't move focus to the control because it is invisible, // not enabled, or of a type that does not accept the focus." for all kinds of // reasons that are too expensive and fragile to test. try { node.focus(); } catch (e) {} }
@param {DOMElement} node input/textarea to focus
focusNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getActiveElement(doc) /*?DOMElement*/{ doc = doc || (typeof document !== 'undefined' ? document : undefined); if (typeof doc === 'undefined') { return null; } try { return doc.activeElement || doc.body; } catch (e) { return doc.body; } }
Same as document.activeElement but wraps in a try-catch block. In IE it is not safe to call document.activeElement if there is nothing focused. The activeElement will be null only if the document or document body is not yet defined. @param {?DOMDocument} doc Defaults to current document. @return {?DOMElement}
getActiveElement
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.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/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function ReactComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue_1; }
Base class helpers for the updating state of a component.
ReactComponent
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
defineDeprecationWarning = function (methodName, info) { Object.defineProperty(ReactComponent.prototype, methodName, { get: function () { lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); return undefined; } }); }
Deprecated APIs. These APIs used to exist on classic React classes but since we would like to deprecate them, we're not going to move them over to this modern base class. Instead, we define a getter that warns if it's accessed.
defineDeprecationWarning
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function ReactPureComponent(props, context, updater) { // Duplicated from ReactComponent. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue_1; }
Base class helpers for the updating state of a component.
ReactPureComponent
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function ReactAsyncComponent(props, context, updater) { // Duplicated from ReactComponent. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue_1; }
Base class helpers for the updating state of a component.
ReactAsyncComponent
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
ReactElement = function (type, key, ref, self, source, owner, props) { var element = { // This tag allow us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE$1, // Built-in properties that belong on the element type: type, key: key, ref: ref, props: props, // ...
Factory method to create a new React element. This no longer adheres to the class pattern, so do not use new to call it. Also, no instanceof check will work. Instead test $$typeof field against Symbol.for('react.element') to check if something is a React Element. @param {*} type @param {*} key @param {string|object} r...
ReactElement
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function escape(key) { var escapeRegex = /[=:]/g; var escaperLookup = { '=': '=0', ':': '=2' }; var escapedString = ('' + key).replace(escapeRegex, function (match) { return escaperLookup[match]; }); return '$' + escapedString; }
Escape and wrap key so it is safe to use as a reactid @param {string} key to be escaped. @return {string} the escaped key.
escape
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function escapeUserProvidedKey(text) { return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); }
TODO: Test that a single child and an array with one item have the same key pattern.
escapeUserProvidedKey
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) { if (traverseContextPool.length) { var traverseContext = traverseContextPool.pop(); traverseContext.result = mapResult; traverseContext.keyPrefix = keyPrefix; traverseContext.func = mapFunction; traverseContext.conte...
TODO: Test that a single child and an array with one item have the same key pattern.
getPooledTraverseContext
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function releaseTraverseContext(traverseContext) { traverseContext.result = null; traverseContext.keyPrefix = null; traverseContext.func = null; traverseContext.context = null; traverseContext.count = 0; if (traverseContextPool.length < POOL_SIZE) { traverseContextPool.push(traverseContext); } }
TODO: Test that a single child and an array with one item have the same key pattern.
releaseTraverseContext
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { var type = typeof children; if (type === 'undefined' || type === 'boolean') { // All of the above are perceived as null. children = null; } if (children === null || type === 'string' || type === 'number' || // The fol...
@param {?*} children Children tree container. @param {!string} nameSoFar Name of the key path so far. @param {!function} callback Callback to invoke with each child found. @param {?*} traverseContext Used to pass information throughout the traversal process. @return {!number} The number of children in this subtree.
traverseAllChildrenImpl
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function traverseAllChildren(children, callback, traverseContext) { if (children == null) { return 0; } return traverseAllChildrenImpl(children, '', callback, traverseContext); }
Traverses children that are typically specified as `props.children`, but might also be specified through attributes: - `traverseAllChildren(this.props.children, ...)` - `traverseAllChildren(this.props.leftPanelChildren, ...)` The `traverseContext` is an optional argument that is passed through the entire traversal. I...
traverseAllChildren
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getComponentKey(component, index) { // Do some typechecking here since we call this blindly. We want to ensure // that we don't block potential future ES APIs. if (typeof component === 'object' && component !== null && component.key != null) { // Explicit key return escape(component.key); } /...
Generate a key string that identifies a component within a set. @param {*} component A component that could contain a manual key. @param {number} index Index that is used if a manual key is not provided. @return {string}
getComponentKey
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function forEachSingleChild(bookKeeping, child, name) { var func = bookKeeping.func, context = bookKeeping.context; func.call(context, child, bookKeeping.count++); }
Generate a key string that identifies a component within a set. @param {*} component A component that could contain a manual key. @param {number} index Index that is used if a manual key is not provided. @return {string}
forEachSingleChild
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function forEachChildren(children, forEachFunc, forEachContext) { if (children == null) { return children; } var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext); traverseAllChildren(children, forEachSingleChild, traverseContext); releaseTraverseContext(traverseContext);...
Iterates through children that are typically specified as `props.children`. See https://facebook.github.io/react/docs/react-api.html#react.children.foreach The provided forEachFunc(child, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} forEachFunc @p...
forEachChildren
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function mapSingleChildIntoContext(bookKeeping, child, childKey) { var result = bookKeeping.result, keyPrefix = bookKeeping.keyPrefix, func = bookKeeping.func, context = bookKeeping.context; var mappedChild = func.call(context, child, bookKeeping.count++); if (Array.isArray(mappedChild)) { ...
Iterates through children that are typically specified as `props.children`. See https://facebook.github.io/react/docs/react-api.html#react.children.foreach The provided forEachFunc(child, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} forEachFunc @p...
mapSingleChildIntoContext
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { var escapedPrefix = ''; if (prefix != null) { escapedPrefix = escapeUserProvidedKey(prefix) + '/'; } var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context); traverseAllChildren(children, mapSingleC...
Iterates through children that are typically specified as `props.children`. See https://facebook.github.io/react/docs/react-api.html#react.children.foreach The provided forEachFunc(child, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} forEachFunc @p...
mapIntoWithKeyPrefixInternal
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; mapIntoWithKeyPrefixInternal(children, result, null, func, context); return result; }
Maps children that are typically specified as `props.children`. See https://facebook.github.io/react/docs/react-api.html#react.children.map The provided mapFunction(child, key, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} func The map function. @p...
mapChildren
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function countChildren(children, context) { return traverseAllChildren(children, emptyFunction.thatReturnsNull, null); }
Count the number of children that are typically specified as `props.children`. See https://facebook.github.io/react/docs/react-api.html#react.children.count @param {?*} children Children tree container. @return {number} The number of children.
countChildren
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function toArray(children) { var result = []; mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; }
Flatten a children object (typically specified as `props.children`) and return an array with appropriately re-keyed children. See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
toArray
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function onlyChild(children) { !ReactElement_1.isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0; return children; }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://facebook.github.io/react/docs/react-api.html#react.children.only The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of this h...
onlyChild
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { info = '\n\nCheck the top-level render call using <' + parentName + '>...
Warn if there's no key explicitly set on dynamic arrays of children or object keys are not valid. This allows us to keep track of children between updates.
getCurrentComponentErrorInfo
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { re...
Warn if the element doesn't have an explicit key assigned to it. This element is in an array. The array could grow and shrink or be reordered. All children that haven't already been validated are required to have a "key" property assigned to it. Error statuses are cached so a warning will only be shown once. @internal...
validateExplicitKey
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function validateChildKeys(node, parentType) { if (typeof node !== 'object') { return; } if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (ReactElement_1.isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if...
Ensure that every element either is passed in a static location, in an array with an explicit keys property defined, or in an object literal with valid key property. @internal @param {ReactNode} node Statically passed child of any type. @param {*} parentType node's parent's type.
validateChildKeys
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function validatePropTypes(element) { var componentClass = element.type; if (typeof componentClass !== 'function') { return; } var name = componentClass.displayName || componentClass.name; var propTypes = componentClass.propTypes; if (propTypes) { currentlyValidatingElement = element; checkProp...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
validatePropTypes
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isNative(fn) { // Based on isNative() from Lodash var funcToString = Function.prototype.toString; var reIsNative = RegExp('^' + funcToString // Take an example native function source for comparison .call(Object.prototype.hasOwnProperty) // Strip regex characters so we can use it for regex .replac...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
isNative
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
getKeyFromID = function (id) { return '.' + id; }
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
getKeyFromID
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
getIDFromKey = function (key) { return parseInt(key.substr(1), 10); }
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
getIDFromKey
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function purgeDeep(id) { var item = getItem(id); if (item) { var childIDs = item.childIDs; removeItem(id); childIDs.forEach(purgeDeep); } }
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
purgeDeep
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getDisplayName$1(element) { if (element == null) { return '#empty'; } else if (typeof element === 'string' || typeof element === 'number') { return '#text'; } else if (typeof element.type === 'string') { return element.type; } else { return element.type.displayName || element.type.name ...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
getDisplayName$1
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function describeID(id) { var name = ReactComponentTreeHook.getDisplayName(id); var element = ReactComponentTreeHook.getElement(id); var ownerID = ReactComponentTreeHook.getOwnerID(id); var ownerName = void 0; if (ownerID) { ownerName = ReactComponentTreeHook.getDisplayName(ownerID); } warning$4(elem...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
describeID
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isTextNode(object) { return isNode(object) && object.nodeType == 3; }
@param {*} object The object to check. @return {boolean} Whether or not the object is a DOM text node.
isTextNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isNode(object) { var doc = object ? object.ownerDocument || object : document; var defaultView = doc.defaultView || window; return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object...
@param {*} object The object to check. @return {boolean} Whether or not the object is a DOM node.
isNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function recomputePluginOrdering() { if (!eventPluginOrder) { // Wait until an `eventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName]; var pluginIndex = eventPluginOrder.indexOf(pluginName); !(pluginIndex > -1) ? invaria...
Recomputes the plugin list using the injected plugins and plugin ordering. @private
recomputePluginOrdering
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; EventPluginRegistry.eventNameDispatchConf...
Publishes an event so that it can be dispatched by the supplied plugin. @param {object} dispatchConfig Dispatch configuration for the event. @param {object} PluginModule Plugin publishing the event. @return {boolean} True if the event was successfully published. @private
publishEventForPlugin
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function publishRegistrationName(registrationName, pluginModule, eventName) { !!EventPluginRegistry.registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0; EventPluginRegistry.registration...
Publishes a registration name that is used to identify dispatched events. @param {string} registrationName Registration name to add. @param {object} PluginModule Plugin publishing the event. @private
publishRegistrationName
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function checkMask(value, bitmask) { return (value & bitmask) === bitmask; }
Injects plugins to be used by `EventPluginHub`. The plugin names must be in the ordering injected by `injectEventPluginOrder`. Plugins can be injected as part of page initialization or on-the-fly. @param {object} injectedNamesToPlugins Map from names to plugin modules. @internal @see {EventPluginHub.injection.injectE...
checkMask
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function shouldPrecacheNode(node, nodeID) { return node.nodeType === ELEMENT_NODE$1 && node.getAttribute(ATTR_NAME) === '' + nodeID || node.nodeType === COMMENT_NODE$1 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === COMMENT_NODE$1 && node.nodeValue === ' react-empty: ' + nodeID + ' '; }
Check if a given node should be cached.
shouldPrecacheNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getRenderedHostOrTextFromComponent(component) { var rendered; while (rendered = component._renderedComponent) { component = rendered; } return component; }
Drill down (through composites and empty components) until we get a host or host text component. This is pretty polymorphic but unavoidable with the current structure we have for `_renderedChildren`.
getRenderedHostOrTextFromComponent
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function precacheNode(inst, node) { var hostInst = getRenderedHostOrTextFromComponent(inst); hostInst._hostNode = node; node[internalInstanceKey] = hostInst; }
Populate `_hostNode` on the rendered host/text component with the given DOM node. The passed `inst` can be a composite.
precacheNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function precacheFiberNode$1(hostInst, node) { node[internalInstanceKey] = hostInst; }
Populate `_hostNode` on the rendered host/text component with the given DOM node. The passed `inst` can be a composite.
precacheFiberNode$1
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function uncacheNode(inst) { var node = inst._hostNode; if (node) { delete node[internalInstanceKey]; inst._hostNode = null; } }
Populate `_hostNode` on the rendered host/text component with the given DOM node. The passed `inst` can be a composite.
uncacheNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function precacheChildNodes(inst, node) { if (inst._flags & Flags.hasCachedChildNodes) { return; } var children = inst._renderedChildren; var childNode = node.firstChild; outer: for (var name in children) { if (!children.hasOwnProperty(name)) { continue; } var childInst = children[name];...
Populate `_hostNode` on each child of `inst`, assuming that the children match up with the DOM (element) children of `node`. We cache entire levels at once to avoid an n^2 problem where we access the children of a node sequentially and have to walk from the start to our target node every time. Since we update `_rende...
precacheChildNodes
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getClosestInstanceFromNode(node) { if (node[internalInstanceKey]) { return node[internalInstanceKey]; } // Walk up the tree until we find an ancestor whose instance we have cached. var parents = []; while (!node[internalInstanceKey]) { parents.push(node); if (node.parentNode) { nod...
Given a DOM node, return the closest ReactDOMComponent or ReactDOMTextComponent instance ancestor.
getClosestInstanceFromNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getInstanceFromNode(node) { var inst = node[internalInstanceKey]; if (inst) { if (inst.tag === HostComponent || inst.tag === HostText) { return inst; } else if (inst._hostNode === node) { return inst; } else { return null; } } inst = getClosestInstanceFromNode(node); ...
Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent instance, or null if the node was not rendered by this React.
getInstanceFromNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getNodeFromInstance(inst) { if (inst.tag === HostComponent || inst.tag === HostText) { // In Fiber this, is just the state node right now. We assume it will be // a host component or host text. return inst.stateNode; } // Without this first invariant, passing a non-DOM-component triggers the...
Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding DOM node.
getNodeFromInstance
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getFiberCurrentPropsFromNode(node) { return node[internalEventHandlersKey] || null; }
Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding DOM node.
getFiberCurrentPropsFromNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function updateFiberProps$1(node, props) { node[internalEventHandlersKey] = props; }
Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding DOM node.
updateFiberProps$1
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) { ReactErrorUtils._hasCaughtError = false; ReactErrorUtils._caughtError = null; var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { ReactErrorUtils._caughtError = error;...
During execution of guarded functions we will capture the first error which we will rethrow to be handled by the top level error handler.
invokeGuardedCallback
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { // Keeps track of whether the user-provided callback threw an error. We // set this to true at the beginning, then set it to false right after // calling the function. If the function errors, `didError` will never be /...
During execution of guarded functions we will capture the first error which we will rethrow to be handled by the top level error handler.
invokeGuardedCallbackDev
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function callCallback() { // We immediately remove the callback from event listeners so that // nested `invokeGuardedCallback` calls do not clash. Otherwise, a // nested call would trigger the fake event handlers of any call higher // in the stack. fakeNode.removeEventListener(ev...
During execution of guarded functions we will capture the first error which we will rethrow to be handled by the top level error handler.
callCallback
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function onError(event) { error = event.error; didSetError = true; if (error === null && event.colno === 0 && event.lineno === 0) { isCrossOriginError = true; } }
During execution of guarded functions we will capture the first error which we will rethrow to be handled by the top level error handler.
onError
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
rethrowCaughtError = function () { if (ReactErrorUtils._hasRethrowError) { var error = ReactErrorUtils._rethrowError; ReactErrorUtils._rethrowError = null; ReactErrorUtils._hasRethrowError = false; throw error; } }
During execution of guarded functions we will capture the first error which we will rethrow to be handled by the top level error handler.
rethrowCaughtError
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isEndish(topLevelType) { return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; }
- `ComponentTree`: [required] Module that can convert between React instances and actual node references.
isEndish
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isMoveish(topLevelType) { return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; }
- `ComponentTree`: [required] Module that can convert between React instances and actual node references.
isMoveish
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isStartish(topLevelType) { return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; }
- `ComponentTree`: [required] Module that can convert between React instances and actual node references.
isStartish
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function executeDispatch(event, simulated, listener, inst) { var type = event.type || 'unknown-event'; event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); ReactErrorUtils_1.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); event.currentTarget = null; }
Dispatch the event to the listener. @param {SyntheticEvent} event SyntheticEvent to handle @param {boolean} simulated If the event is simulated (changes exn behavior) @param {function} listener Application-level callback @param {*} inst Internal component instance
executeDispatch
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function executeDispatchesInOrder(event, simulated) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isP...
Standard/simple iteration through an event's collected dispatches.
executeDispatchesInOrder
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function executeDispatchesInOrderStopAtTrueImpl(event) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event....
Standard/simple iteration through an event's collected dispatches, but stops at the first dispatch execution returning true, and returns that id. @return {?string} id of the first dispatch execution who's listener returns true, or null if no listener returned true.
executeDispatchesInOrderStopAtTrueImpl
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function executeDirectDispatch(event) { { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchInstance = event._dispatchInstances; !!Array.isArray(dispatchListener) ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0; event.currentTarget...
Execution of a "direct" dispatch - there must be at most one dispatch accumulated on the event or it is considered an error. It doesn't really make sense for an event with multiple dispatches (bubbled) to keep track of the return values at each dispatch execution, but it does tend to make sense when dealing with "direc...
executeDirectDispatch
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function hasDispatches(event) { return !!event._dispatchListeners; }
@param {SyntheticEvent} event @return {boolean} True iff number of dispatches accumulated is greater than 0.
hasDispatches
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function restoreStateOfTarget(target) { // We perform this translation at the end of the event loop so that we // always receive the correct fiber here var internalInstance = EventPluginUtils_1.getInstanceFromNode(target); if (!internalInstance) { // Unmounted return; } if (typeof internalInstance.t...
General utilities that are useful in creating custom Event Plugins.
restoreStateOfTarget
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
stackBatchedUpdates = function (fn, a, b, c, d, e) { return fn(a, b, c, d, e); }
General utilities that are useful in creating custom Event Plugins.
stackBatchedUpdates
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
fiberBatchedUpdates = function (fn, bookkeeping) { return fn(bookkeeping); }
General utilities that are useful in creating custom Event Plugins.
fiberBatchedUpdates
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function performFiberBatchedUpdates(fn, bookkeeping) { // If we have Fiber loaded, we need to wrap this in a batching call so that // Fiber can apply its default priority for this call. return fiberBatchedUpdates(fn, bookkeeping); }
General utilities that are useful in creating custom Event Plugins.
performFiberBatchedUpdates
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function batchedUpdates(fn, bookkeeping) { // We first perform work with the stack batching strategy, by passing our // indirection to it. return stackBatchedUpdates(performFiberBatchedUpdates, fn, bookkeeping); }
General utilities that are useful in creating custom Event Plugins.
batchedUpdates
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function batchedUpdatesWithControlledComponents(fn, bookkeeping) { if (isNestingBatched) { // If we are currently inside another batch, we need to wait until it // fully completes before restoring state. Therefore, we add the target to // a queue of work. return batchedUpdates(fn, bookkeeping); } ...
General utilities that are useful in creating custom Event Plugins.
batchedUpdatesWithControlledComponents
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getEventTarget(nativeEvent) { var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963 if (target.correspondingUseElement) { target = target.correspondingUseElement; } // Safari may fire events on text nodes (Node.TEXT_NODE is 3). // @se...
Gets the target node from a native browser event by accounting for inconsistencies in browser DOM APIs. @param {object} nativeEvent Native browser event. @return {DOMEventTarget} Target node.
getEventTarget
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function findRootContainerNode(inst) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. if (typeof inst.tag === 'number') { while (inst['return']) { inst = ...
Find the deepest React component completely containing the root of the passed-in instance (for use when entire React trees are nested within each other). If React trees are not nested, returns null.
findRootContainerNode
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { if (callbackBookkeepingPool.length) { var instance = callbackBookkeepingPool.pop(); instance.topLevelType = topLevelType; instance.nativeEvent = nativeEvent; instance.targetInst = targetInst; return instance; } re...
Find the deepest React component completely containing the root of the passed-in instance (for use when entire React trees are nested within each other). If React trees are not nested, returns null.
getTopLevelCallbackBookKeeping
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function releaseTopLevelCallbackBookKeeping(instance) { instance.topLevelType = null; instance.nativeEvent = null; instance.targetInst = null; instance.ancestors.length = 0; if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { callbackBookkeepingPool.push(instance); } }
Find the deepest React component completely containing the root of the passed-in instance (for use when entire React trees are nested within each other). If React trees are not nested, returns null.
releaseTopLevelCallbackBookKeeping
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function handleTopLevelImpl(bookKeeping) { var targetInst = bookKeeping.targetInst; // Loop through the hierarchy, in case there's any nested components. // It's important that we build the array of ancestors before calling any // event handlers, because event handlers can modify the DOM, leading to // incon...
Find the deepest React component completely containing the root of the passed-in instance (for use when entire React trees are nested within each other). If React trees are not nested, returns null.
handleTopLevelImpl
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function accumulateInto(current, next) { !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0; if (current == null) { return next; } // Both are not empty. Warning: Never call x.concat(y) when you are not // certain that x is an Array (x co...
Accumulates items that must not be null or undefined into the first one. This is used to conserve memory by avoiding array allocations, and thus sacrifices API cleanness. Since `current` can be null before being passed in and not null after this function, make sure to assign it back to `current`: `a = accumulateInto(a...
accumulateInto
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function forEachAccumulated(arr, cb, scope) { if (Array.isArray(arr)) { arr.forEach(cb, scope); } else if (arr) { cb.call(scope, arr); } }
@param {array} arr an "accumulation" of items which is either an Array or a single item. Useful when paired with the `accumulate` module. This is a simple utility that allows us to reason about a collection of items, but handling the case when there is exactly one item (and we do not need to allocate an array). @param ...
forEachAccumulated
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
executeDispatchesAndRelease = function (event, simulated) { if (event) { EventPluginUtils_1.executeDispatchesInOrder(event, simulated); if (!event.isPersistent()) { event.constructor.release(event); } } }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
executeDispatchesAndRelease
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
executeDispatchesAndReleaseSimulated = function (e) { return executeDispatchesAndRelease(e, true); }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
executeDispatchesAndReleaseSimulated
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
executeDispatchesAndReleaseTopLevel = function (e) { return executeDispatchesAndRelease(e, false); }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
executeDispatchesAndReleaseTopLevel
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isInteractive(tag) { return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
isInteractive
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function shouldPreventMouseEvent(name, type, props) { switch (name) { case 'onClick': case 'onClickCapture': case 'onDoubleClick': case 'onDoubleClickCapture': case 'onMouseDown': case 'onMouseDownCapture': case 'onMouseMove': case 'onMouseMoveCapture': case 'onMouseUp': case '...
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
shouldPreventMouseEvent
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function runEventQueueInBatch(events) { EventPluginHub_1.enqueueEvents(events); EventPluginHub_1.processEventQueue(false); }
Dispatches all synthetic events on the event queue. @internal
runEventQueueInBatch
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function makePrefixMap(styleProp, eventName) { var prefixes = {}; prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); prefixes['Webkit' + styleProp] = 'webkit' + eventName; prefixes['Moz' + styleProp] = 'moz' + eventName; prefixes['ms' + styleProp] = 'MS' + eventName; prefixes['O' + styleProp] = '...
Generate a mapping of standard vendor prefixes using the defined style property and event name. @param {string} styleProp @param {string} eventName @returns {object}
makePrefixMap
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getVendorPrefixedEventName(eventName) { if (prefixedEventNames[eventName]) { return prefixedEventNames[eventName]; } else if (!vendorPrefixes[eventName]) { return eventName; } var prefixMap = vendorPrefixes[eventName]; for (var styleProp in prefixMap) { if (prefixMap.hasOwnProperty(styl...
Attempts to determine the correct vendor prefixed event name. @param {string} eventName @returns {string}
getVendorPrefixedEventName
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function getListeningForDocument(mountAt) { // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` // directly. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { mountAt[topListenersIDKey] = reactTopListenersCounter++; alreadyListeningTo[mountAt[topListenersIDKey]] ...
To ensure no conflicts with other potential React instances on the page
getListeningForDocument
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function prefixKey(prefix, key) { return prefix + key.charAt(0).toUpperCase() + key.substring(1); }
@param {string} prefix vendor-specific prefix, eg: Webkit @param {string} key style name, eg: transitionDuration @return {string} style name prefixed with `prefix`, properly camelCased, eg: WebkitTransitionDuration
prefixKey
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function dangerousStyleValue(name, value, isCustomProperty) { // Note that we've removed escapeTextForBrowser() calls here since the // whole string will be escaped when the attribute is injected into // the markup. If you provide unsafe user data here they can inject // arbitrary CSS which may be problematic (...
Convert a value into the proper css writable value. The style name `name` should be logical (no hyphens), as specified in `CSSProperty.isUnitlessNumber`. @param {string} name CSS property name such as `topMargin`. @param {*} value CSS property value such as `10px`. @return {string} Normalized style value with dimensio...
dangerousStyleValue
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
warnInvalidSetState = function () { warning$7(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()'); }
Sets the value for multiple styles on a node. If a value is specified as '' (empty string), the corresponding style property will be unset. @param {DOMElement} node @param {object} styles @param {ReactDOMComponent} component
warnInvalidSetState
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function isControlled(props) { var usesChecked = props.type === 'checkbox' || props.type === 'radio'; return usesChecked ? props.checked != null : props.value != null; }
Provide a linked `value` attribute for controlled forms. You should not use this outside of the ReactDOM controlled form components.
isControlled
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function updateNamedCousins(rootNode, props) { var name = props.name; if (props.type === 'radio' && name != null) { var queryRoot = rootNode; while (queryRoot.parentNode) { queryRoot = queryRoot.parentNode; } // If `rootNode.form` was non-null, then we could try `form.elements`, // but t...
Implements an <input> host component that allows setting these optional props: `checked`, `value`, `defaultChecked`, and `defaultValue`. If `checked` or `value` are not supplied (or null/undefined), user actions that affect the checked state or value will trigger updates to the element. If they are supplied (and not ...
updateNamedCousins
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT
function flattenChildren(children) { var content = ''; // Flatten children and warn if they aren't strings or numbers; // invalid types are ignored. // We can silently skip them because invalid DOM nesting warning // catches these cases in Fiber. react.Children.forEach(children, function (child) { if (...
Implements an <input> host component that allows setting these optional props: `checked`, `value`, `defaultChecked`, and `defaultValue`. If `checked` or `value` are not supplied (or null/undefined), user actions that affect the checked state or value will trigger updates to the element. If they are supplied (and not ...
flattenChildren
javascript
agermanidis/livepython
dist/main.js
https://github.com/agermanidis/livepython/blob/master/dist/main.js
MIT