azatoth/twinkle — Issue #69: Fix regex on Cookies.exists
Author: mybugs
Created: 2011-10-25 20:05:04+00:00
State: open

On
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jquery.cookie.js?view=markup
there is the following:
var re = new RegExp( ";\\s*" + name + "=" );

This regex doesn't match a cookie whose name is in the beginning of the string, because the ";" is only used after the first pair of key/value. A possible fix would be to change that line to
var re = new RegExp( "(?:^|;)\\s*" + name + "=" );

Compare:
http://www.rubular.com/r/UYVs9PzKBo
http://www.rubular.com/r/EhBQiu0fdh