MCPcopy Create free account
hub / github.com/TruthHun/BookStack / addOption

Function addOption

static/bootstrap-select-1.13.18/js/bootstrap-select.js:1527–1564  ·  view source on GitHub ↗
(option, config)

Source from the content-addressed store, hash-verified

1525 }
1526
1527 function addOption (option, config) {
1528 config = config || {};
1529
1530 config.divider = option.getAttribute('data-divider') === 'true';
1531
1532 if (config.divider) {
1533 addDivider({
1534 optID: config.optID
1535 });
1536 } else {
1537 var liIndex = mainData.length,
1538 cssText = option.style.cssText,
1539 inlineStyle = cssText ? htmlEscape(cssText) : '',
1540 optionClass = (option.className || '') + (config.optgroupClass || '');
1541
1542 if (config.optID) optionClass = 'opt ' + optionClass;
1543
1544 config.optionClass = optionClass.trim();
1545 config.inlineStyle = inlineStyle;
1546 config.text = option.textContent;
1547
1548 config.content = option.getAttribute('data-content');
1549 config.tokens = option.getAttribute('data-tokens');
1550 config.subtext = option.getAttribute('data-subtext');
1551 config.icon = option.getAttribute('data-icon');
1552
1553 option.liIndex = liIndex;
1554
1555 config.display = config.content || config.text;
1556 config.type = 'option';
1557 config.index = liIndex;
1558 config.option = option;
1559 config.selected = !!option.selected;
1560 config.disabled = config.disabled || !!option.disabled;
1561
1562 mainData.push(config);
1563 }
1564 }
1565
1566 function addOptgroup (index, selectOptions) {
1567 var optgroup = selectOptions[index],

Callers 2

addOptgroupFunction · 0.85

Calls 2

addDividerFunction · 0.85
getAttributeMethod · 0.80

Tested by

no test coverage detected