MCPcopy Create free account
hub / github.com/reactjs/react-rails / isAttributeNameSafe

Function isAttributeNameSafe

lib/assets/react-source/development/react.js:4575–4596  ·  view source on GitHub ↗
(attributeName)

Source from the content-addressed store, hash-verified

4573 var illegalAttributeNameCache = {};
4574 var validatedAttributeNameCache = {};
4575 function isAttributeNameSafe(attributeName) {
4576 if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
4577 return true;
4578 }
4579
4580 if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
4581 return false;
4582 }
4583
4584 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
4585 validatedAttributeNameCache[attributeName] = true;
4586 return true;
4587 }
4588
4589 illegalAttributeNameCache[attributeName] = true;
4590
4591 {
4592 error('Invalid attribute name: `%s`', attributeName);
4593 }
4594
4595 return false;
4596 }
4597 function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
4598 if (propertyInfo !== null) {
4599 return propertyInfo.type === RESERVED;

Callers 2

getValueForAttributeFunction · 0.70
setValueForPropertyFunction · 0.70

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected