MCPcopy Create free account
hub / github.com/caseywebdev/react-list / validateProperty

Function validateProperty

docs/index.js:21467–21709  ·  view source on GitHub ↗
(tagName, name, value, eventRegistry)

Source from the content-addressed store, hash-verified

21465 );
21466 }
21467 function validateProperty(tagName, name, value, eventRegistry) {
21468 if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name])
21469 return !0;
21470 var lowerCasedName = name.toLowerCase();
21471 if ("onfocusin" === lowerCasedName || "onfocusout" === lowerCasedName)
21472 return (
21473 console.error(
21474 "React uses onFocus and onBlur instead of onFocusIn and onFocusOut. All React events are normalized to bubble, so onFocusIn and onFocusOut are not needed/supported by React."
21475 ),
21476 (warnedProperties[name] = !0)
21477 );
21478 if (
21479 "function" === typeof value &&
21480 (("form" === tagName && "action" === name) ||
21481 ("input" === tagName && "formAction" === name) ||
21482 ("button" === tagName && "formAction" === name))
21483 )
21484 return !0;
21485 if (null != eventRegistry) {
21486 tagName = eventRegistry.possibleRegistrationNames;
21487 if (eventRegistry.registrationNameDependencies.hasOwnProperty(name))
21488 return !0;
21489 eventRegistry = tagName.hasOwnProperty(lowerCasedName)
21490 ? tagName[lowerCasedName]
21491 : null;
21492 if (null != eventRegistry)
21493 return (
21494 console.error(
21495 "Invalid event handler property `%s`. Did you mean `%s`?",
21496 name,
21497 eventRegistry
21498 ),
21499 (warnedProperties[name] = !0)
21500 );
21501 if (EVENT_NAME_REGEX.test(name))
21502 return (
21503 console.error(
21504 "Unknown event handler property `%s`. It will be ignored.",
21505 name
21506 ),
21507 (warnedProperties[name] = !0)
21508 );
21509 } else if (EVENT_NAME_REGEX.test(name))
21510 return (
21511 INVALID_EVENT_NAME_REGEX.test(name) &&
21512 console.error(
21513 "Invalid event handler property `%s`. React events use the camelCase naming convention, for example `onClick`.",
21514 name
21515 ),
21516 (warnedProperties[name] = !0)
21517 );
21518 if (rARIA.test(name) || rARIACamel.test(name)) return !0;
21519 if ("innerhtml" === lowerCasedName)
21520 return (
21521 console.error(
21522 "Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`."
21523 ),
21524 (warnedProperties[name] = !0)

Callers 1

warnUnknownPropertiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…