MCPcopy
hub / github.com/processing/p5.js / _elementName

Function _elementName

src/accessibility/describe.js:387–401  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

385
386 //check that name is not LABEL or FALLBACK and ensure text ends with colon
387 function _elementName(name) {
388 if (name === 'label' || name === 'fallback') {
389 throw new Error('element name should not be LABEL or FALLBACK');
390 }
391 //check if last character of string n is '.', ';', or ','
392 if (name.endsWith('.') || name.endsWith(';') || name.endsWith(',')) {
393 //replace last character with ':'
394 name = name.replace(/.$/, ':');
395 } else if (!name.endsWith(':')) {
396 //if string n does not end with ':'
397 //add ':'' at the end of string
398 name = name + ':';
399 }
400 return name;
401 }
402
403 //creates HTML structure for element descriptions
404 fn._describeElementHTML = function(type, name, text) {

Callers 1

describeFunction · 0.85

Calls

no outgoing calls

Tested by 1

describeFunction · 0.68