case 'filter':
el.style.display = set ? '' : 'none';
if (!Element.prototype.hasOwnProperty('classList')) return;
- // continue
+ el.classList.remove('focus');
+ break;
default: // reset
el.classList.remove('focus');
el.classList.remove('target');
function filterrows(table, match, action) {
var rows = table.tBodies[0].rows;
for (var i = 0; i < rows.length; i++) {
- filtercell(rows[i], match(rows[i]), action);
+ filtercell(rows[i], match && match(rows[i]), action);
}
}
return row.cells[0].title.match(query, 'i');
};
}
+ else if (action == 'focus' && query.length <= 1) {
+ // prevent superfluous highlighting
+ var match = false;
+ }
else {
// title text (case-insensitive unless caps in input)
var match = function(row) {
newelement('input', {
type: 'search',
name: 'q',
- onkeyup: "filtertable(this.value, this.value.length > 1 ? 'focus' : 'reset')",
+ onkeyup: "filtertable(this.value, 'focus')",
}),
newelement('input', {
type: 'button',