Permalink
Browse files

Datalist polyfill: Fixed polyfill so only displays value if value and…

… label are identical and also corrected undefined checks (fixes #2823 and supercedes #2831).
  • Loading branch information...
pjackson28 committed Aug 15, 2013
1 parent 4a3249e commit c5d77153f30b8fa737ad00c4582b029fa1e41c47
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/js/polyfills/datalist.js
@@ -80,10 +80,10 @@
var $this = $(this),
value = $this.attr('value'),
label = $this.attr('label');
if (value === 'undefined') {
if (typeof value === 'undefined') {
value = $this.text();
}
datalist_items.push('<li class="al-option" id="al-option-' + index + '-' + index2 + '"><a href="javascript:;"><span class="al-value">' + (value !== 'undefined' ? value : "") + '</span><span class="al-label">' + (label !== 'undefined' ? label : "") + '</span></a></li>');
datalist_items.push('<li class="al-option" id="al-option-' + index + '-' + index2 + '"><a href="javascript:;"><span class="al-value">' + (typeof value !== 'undefined' ? value : '') + '</span><span class="al-label">' + (typeof label !== 'undefined' && value !== label ? label : '') + '</span></a></li>');
});
elm.attr({'autocomplete': 'off', 'role': 'textbox', 'aria-haspopup': 'true', 'aria-autocomplete': 'list', 'aria-owns': 'wb-autolist-' + index, 'aria-activedescendent': ''}).wrap('<div class="wb-al-container" role="application" aria-' + (label.length !== 0 ? 'labelledby="' + uniqueid : '-label="' + elm.attr('title')) + '"/>');

0 comments on commit c5d7715

Please sign in to comment.