MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / validateProperty

Function validateProperty

bundle.js:6578–6584  ·  view source on GitHub ↗
(tagName,name,debugID)

Source from the content-addressed store, hash-verified

6576'aria-activedescendant':0,'aria-colcount':0,'aria-colindex':0,'aria-colspan':0,'aria-controls':0,'aria-describedby':0,'aria-errormessage':0,'aria-flowto':0,'aria-labelledby':0,'aria-owns':0,'aria-posinset':0,'aria-rowcount':0,'aria-rowindex':0,'aria-rowspan':0,'aria-setsize':0};var validAriaProperties$1=ariaProperties;var warnedProperties={};var rARIA=new RegExp('^(aria)-['+DOMProperty_1.ATTRIBUTE_NAME_CHAR+']*$');var rARIACamel=new RegExp('^(aria)[A-Z]['+DOMProperty_1.ATTRIBUTE_NAME_CHAR+']*$');var hasOwnProperty=Object.prototype.hasOwnProperty;{var warning$14=require$$0;var _require$5=ReactGlobalSharedState_1,ReactComponentTreeHook$1=_require$5.ReactComponentTreeHook,ReactDebugCurrentFrame$1=_require$5.ReactDebugCurrentFrame;var getStackAddendumByID=ReactComponentTreeHook$1.getStackAddendumByID;var validAriaProperties=validAriaProperties$1;}function getStackAddendum(debugID){if(debugID!=null){// This can only happen on Stack
6577return getStackAddendumByID(debugID);}else{// This can only happen on Fiber / Server
6578var stack=ReactDebugCurrentFrame$1.getStackAddendum();return stack!=null?stack:'';}}function validateProperty(tagName,name,debugID){if(hasOwnProperty.call(warnedProperties,name)&&warnedProperties[name]){return true;}if(rARIACamel.test(name)){var ariaName='aria-'+name.slice(4).toLowerCase();var correctName=validAriaProperties.hasOwnProperty(ariaName)?ariaName:null;// If this is an aria-* attribute, but is not listed in the known DOM
6579// DOM properties, then it is an invalid aria-* attribute.
6580if(correctName==null){warning$14(false,'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s',name,getStackAddendum(debugID));warnedProperties[name]=true;return true;}// aria-* attributes should be lowercase; suggest the lowercase version.
6581if(name!==correctName){warning$14(false,'Invalid ARIA attribute `%s`. Did you mean `%s`?%s',name,correctName,getStackAddendum(debugID));warnedProperties[name]=true;return true;}}if(rARIA.test(name)){var lowerCasedName=name.toLowerCase();var standardName=validAriaProperties.hasOwnProperty(lowerCasedName)?lowerCasedName:null;// If this is an aria-* attribute, but is not listed in the known DOM
6582// DOM properties, then it is an invalid aria-* attribute.
6583if(standardName==null){warnedProperties[name]=true;return false;}// aria-* attributes should be lowercase; suggest the lowercase version.
6584if(name!==standardName){warning$14(false,'Unknown ARIA attribute `%s`. Did you mean `%s`?%s',name,standardName,getStackAddendum(debugID));warnedProperties[name]=true;return true;}}return true;}function warnInvalidARIAProps(type,props,debugID){var invalidProps=[];for(var key in props){var isValid=validateProperty(type,key,debugID);if(!isValid){invalidProps.push(key);}}var unknownPropString=invalidProps.map(function(prop){return'`'+prop+'`';}).join(', ');if(invalidProps.length===1){warning$14(false,'Invalid aria prop %s on <%s> tag. '+'For details, see https://fb.me/invalid-aria-prop%s',unknownPropString,type,getStackAddendum(debugID));}else if(invalidProps.length>1){warning$14(false,'Invalid aria props %s on <%s> tag. '+'For details, see https://fb.me/invalid-aria-prop%s',unknownPropString,type,getStackAddendum(debugID));}}function validateProperties(type,props,debugID/* Stack only */){if(isCustomComponent_1(type,props)){return;}warnInvalidARIAProps(type,props,debugID);}var ReactDOMInvalidARIAHook$1={// Fiber
6585validateProperties:validateProperties,// Stack
6586onBeforeMountComponent:function onBeforeMountComponent(debugID,element){if(true&&element!=null&&typeof element.type==='string'){validateProperties(element.type,element.props,debugID);}},onBeforeUpdateComponent:function onBeforeUpdateComponent(debugID,element){if(true&&element!=null&&typeof element.type==='string'){validateProperties(element.type,element.props,debugID);}}};var ReactDOMInvalidARIAHook_1=ReactDOMInvalidARIAHook$1;{var warning$15=require$$0;var _require$6=ReactGlobalSharedState_1,ReactComponentTreeHook$2=_require$6.ReactComponentTreeHook,ReactDebugCurrentFrame$2=_require$6.ReactDebugCurrentFrame;var getStackAddendumByID$1=ReactComponentTreeHook$2.getStackAddendumByID;}var didWarnValueNull=false;function getStackAddendum$1(debugID){if(debugID!=null){// This can only happen on Stack
6587return getStackAddendumByID$1(debugID);}else{// This can only happen on Fiber / Server

Callers 1

warnInvalidARIAPropsFunction · 0.85

Calls 1

getStackAddendumFunction · 0.85

Tested by

no test coverage detected