Skip to content

Commit

Permalink
Add title for <optgroup>
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Doan committed Mar 2, 2017
1 parent 2f6b925 commit b8d6253
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dist/js/jquery.prettydropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@
// Construct menu item
renderItem = function(elOpt, sClass, bSelected) {
var sGroup = '',
sText;
sText,
sTitle;
sClass = sClass || '';
if (elOpt) {
switch (elOpt.nodeName) {
Expand All @@ -338,13 +339,15 @@
break;
}
if (elOpt.disabled || (sGroup && elOpt.parentNode.disabled)) sClass += ' disabled';
sTitle = elOpt.title;
if (sGroup && !sTitle) sTitle = elOpt.parentNode.title;
}
++nCount;
return '<li id="item' + nTimestamp + '-' + nCount + '"'
+ (sGroup ? ' data-group="' + sGroup + '"' : '')
+ (elOpt && elOpt.value ? ' data-value="' + elOpt.value + '"' : '')
+ (elOpt && elOpt.nodeName==='OPTION' ? ' role="option"' : '')
+ (elOpt && elOpt.title ? ' title="' + elOpt.title + '" aria-label="' + elOpt.title + '"' : '')
+ (sTitle ? ' title="' + sTitle + '" aria-label="' + sTitle + '"' : '')
+ (sClass ? ' class="' + $.trim(sClass) + '"' : '')
+ ((oOptions.height!==50) ? ' style="height:' + (oOptions.height-2)
+ 'px;line-height:' + (oOptions.height-2) + 'px"' : '') + '>' + sText
Expand Down

0 comments on commit b8d6253

Please sign in to comment.