(option, config)
| 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], |
no test coverage detected