MCPcopy Create free account
hub / github.com/microsoft/SandDance / validateProperty

Function validateProperty

docs/external/js/react-dom.development.js:5466–5514  ·  view source on GitHub ↗
(tagName, name)

Source from the content-addressed store, hash-verified

5464 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
5465
5466 function validateProperty(tagName, name) {
5467 {
5468 if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
5469 return true;
5470 }
5471
5472 if (rARIACamel.test(name)) {
5473 var ariaName = 'aria-' + name.slice(4).toLowerCase();
5474 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
5475 // DOM properties, then it is an invalid aria-* attribute.
5476
5477 if (correctName == null) {
5478 error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
5479
5480 warnedProperties[name] = true;
5481 return true;
5482 } // aria-* attributes should be lowercase; suggest the lowercase version.
5483
5484
5485 if (name !== correctName) {
5486 error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
5487
5488 warnedProperties[name] = true;
5489 return true;
5490 }
5491 }
5492
5493 if (rARIA.test(name)) {
5494 var lowerCasedName = name.toLowerCase();
5495 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
5496 // DOM properties, then it is an invalid aria-* attribute.
5497
5498 if (standardName == null) {
5499 warnedProperties[name] = true;
5500 return false;
5501 } // aria-* attributes should be lowercase; suggest the lowercase version.
5502
5503
5504 if (name !== standardName) {
5505 error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
5506
5507 warnedProperties[name] = true;
5508 return true;
5509 }
5510 }
5511 }
5512
5513 return true;
5514 }
5515
5516 function warnInvalidARIAProps(type, props) {
5517 {

Callers 1

warnInvalidARIAPropsFunction · 0.85

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected