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

Function validateProperty

code/third-party/public/app.js:14969–15012  ·  view source on GitHub ↗
(tagName, name)

Source from the content-addressed store, hash-verified

14967}
14968
14969function validateProperty(tagName, name) {
14970 if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
14971 return true;
14972 }
14973
14974 if (rARIACamel.test(name)) {
14975 var ariaName = 'aria-' + name.slice(4).toLowerCase();
14976 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
14977
14978 // If this is an aria-* attribute, but is not listed in the known DOM
14979 // DOM properties, then it is an invalid aria-* attribute.
14980 if (correctName == null) {
14981 warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum());
14982 warnedProperties[name] = true;
14983 return true;
14984 }
14985 // aria-* attributes should be lowercase; suggest the lowercase version.
14986 if (name !== correctName) {
14987 warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum());
14988 warnedProperties[name] = true;
14989 return true;
14990 }
14991 }
14992
14993 if (rARIA.test(name)) {
14994 var lowerCasedName = name.toLowerCase();
14995 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
14996
14997 // If this is an aria-* attribute, but is not listed in the known DOM
14998 // DOM properties, then it is an invalid aria-* attribute.
14999 if (standardName == null) {
15000 warnedProperties[name] = true;
15001 return false;
15002 }
15003 // aria-* attributes should be lowercase; suggest the lowercase version.
15004 if (name !== standardName) {
15005 warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum());
15006 warnedProperties[name] = true;
15007 return true;
15008 }
15009 }
15010
15011 return true;
15012}
15013
15014function warnInvalidARIAProps(type, props) {
15015 var invalidProps = [];

Callers 1

warnInvalidARIAPropsFunction · 0.70

Calls 2

warningFunction · 0.85
getStackAddendumFunction · 0.70

Tested by

no test coverage detected