| Back to top |
How about that :
:: Code :: function getCookie(search_name) {
// note: document.cookie only returns name=value, not the other components var tab_cookies = document.cookie.split( ';' ); for ( i = 0; i < tab_cookies.length; i++ ) { // now we'll split apart each name=value pair var cookie_tmp = tab_cookies[i].split('='); // and trim left/right whitespace while we're at it var cookie_name = cookie_tmp[0].replace(/^\s+|\s+$/g, ''); // if the extracted name matches passed search_name if (cookie_name==search_name) { // we need to handle case where cookie has no value but exists (no = sign, that is): if (cookie_tmp.length>1) { return unescape( cookie_tmp[1].replace(/^\s+|\s+$/g, '') ); } // cookie is initialized but no value => result = null return null; } } return null; } |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 747 Location: East Coast, West Coast? I know it's one of them. |
what problem does it fix?
I'll take a look at the code, but what did you find to be the issue that needed fixing? |
|||||
| Back to top |
It doesn't fix anything.
You may have done some tests and you had left some variables that were useless. It's just an optimized version, where I've removed variables that were of no use in your code. Because you've been helpful to me, I've done a lighter and more optimized version. I hope you like it. Regards, Olivier Pons |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 747 Location: East Coast, West Coast? I know it's one of them. |
oh, ok, thanks, somebody a while ago proposed a patch that fixed an actual bug that had been in this code for probably 10 years, just wanted to know what level this was.
Thanks for taking a look at the code, I'll double check and confirm, then add the patches, thanks. |
|||||
|
All times are GMT - 8 Hours
|
||||||
Contact Us
Hosting: Pair Networks: 0.044
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info
Hosting: Pair Networks: 0.044
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info