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

Function isAttributeNameSafe

docs/external/js/react-dom.development.js:898–919  ·  view source on GitHub ↗
(attributeName)

Source from the content-addressed store, hash-verified

896 var illegalAttributeNameCache = {};
897 var validatedAttributeNameCache = {};
898 function isAttributeNameSafe(attributeName) {
899 if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
900 return true;
901 }
902
903 if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
904 return false;
905 }
906
907 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
908 validatedAttributeNameCache[attributeName] = true;
909 return true;
910 }
911
912 illegalAttributeNameCache[attributeName] = true;
913
914 {
915 error('Invalid attribute name: `%s`', attributeName);
916 }
917
918 return false;
919 }
920 function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
921 if (propertyInfo !== null) {
922 return propertyInfo.type === RESERVED;

Callers 2

getValueForAttributeFunction · 0.85
setValueForPropertyFunction · 0.85

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected