| 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) { |