MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / validateProperty

Function validateProperty

code/redux/public/app.js:15987–16030  ·  view source on GitHub ↗
(tagName, name)

Source from the content-addressed store, hash-verified

15985}
15986
15987function validateProperty(tagName, name) {
15988 if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
15989 return true;
15990 }
15991
15992 if (rARIACamel.test(name)) {
15993 var ariaName = 'aria-' + name.slice(4).toLowerCase();
15994 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
15995
15996 // If this is an aria-* attribute, but is not listed in the known DOM
15997 // DOM properties, then it is an invalid aria-* attribute.
15998 if (correctName == null) {
15999 warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum());
16000 warnedProperties[name] = true;
16001 return true;
16002 }
16003 // aria-* attributes should be lowercase; suggest the lowercase version.
16004 if (name !== correctName) {
16005 warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum());
16006 warnedProperties[name] = true;
16007 return true;
16008 }
16009 }
16010
16011 if (rARIA.test(name)) {
16012 var lowerCasedName = name.toLowerCase();
16013 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
16014
16015 // If this is an aria-* attribute, but is not listed in the known DOM
16016 // DOM properties, then it is an invalid aria-* attribute.
16017 if (standardName == null) {
16018 warnedProperties[name] = true;
16019 return false;
16020 }
16021 // aria-* attributes should be lowercase; suggest the lowercase version.
16022 if (name !== standardName) {
16023 warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum());
16024 warnedProperties[name] = true;
16025 return true;
16026 }
16027 }
16028
16029 return true;
16030}
16031
16032function warnInvalidARIAProps(type, props) {
16033 var invalidProps = [];

Callers 1

warnInvalidARIAPropsFunction · 0.70

Calls 2

warningFunction · 0.85
getStackAddendumFunction · 0.70

Tested by

no test coverage detected