Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pinboard.in autocomplete "exact match" bug

Unminified fragment (pin.js, Pin.Tags.prototype.filter, line 884):

if (Pin.Lang.indexOf(words, w) >= 0)  // case-sensitive
{
    lis[i].className = 'selected';
}

Minified:

if(Pin.Lang.indexOf(f,g)>=0||(d&&g===a)||(!d&&g.toLowerCase()===a.toLowerCase())){
    j[b].className="selected"
}

Observations:

  1. Extra conditions exist in the minified code
  2. These conditions (specifically, the toLowerCase portion) cause .selected to be applied to the li
  3. .selected causes the li to be hidden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment