Skip to content

Instantly share code, notes, and snippets.

@abackstrom
Created September 15, 2011 03:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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