Skip to content

Instantly share code, notes, and snippets.

@abackstrom
Created September 15, 2011 03:00
Show Gist options
  • Save abackstrom/1218415 to your computer and use it in GitHub Desktop.
Save abackstrom/1218415 to your computer and use it in GitHub Desktop.
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