- From: Nicholas Zakas <nzakas@yahoo-inc.com>
- Date: Wed, 24 Feb 2010 11:11:47 -0800
I like the idea of creating an easier way to deal with cookies (which is why I wrote the YUI Cookie utility way back when). The thing that seems to be missing in your proposed API is what I consider to be the most common use case: retrieving the value of a single cookie. There's not many times when I need to get every single cookie that's available on the page, but there are plenty of times when I want to check the value of a single cookie. Using your API, getting the value of a single cookie with a known name becomes: document.getCookies(function(cookies) { for (var i=0; i < cookies.length; ++i){ if(cookies[i].name == "my_cookie_name"){ doSomething(cookies[i]); } } }); That seems like a lot of work just to retrieve a single cookie value. I'm also less-than-thrilled with this being asynchronous, as I think the use cases for cookies are vastly differently than those for databases and web storage. The world is already parsing cookies synchronously right now, it doesn't seem like asynchronicity buys much benefit, it just introduces an additional level of indirection. -Nicholas ______________________________________________ Commander Lock: "Damnit Morpheus, not everyone believes what you believe!" Morpheus: "My beliefs do not require them to." -----Original Message----- From: whatwg-bounces@lists.whatwg.org [mailto:whatwg-bounces@lists.whatwg.org] On Behalf Of Adam Barth Sent: Wednesday, February 24, 2010 8:47 AM To: Darin Fisher Cc: whatwg Subject: Re: [whatwg] HTML Cookie API Done. On Wed, Feb 24, 2010 at 12:29 AM, Darin Fisher <darin at chromium.org> wrote: > An explicit deleteCookie method might also be nice. > -Darin > > On Tue, Feb 23, 2010 at 8:56 PM, Adam Barth <w3c at adambarth.com> wrote: >> >> The document.cookie API is kind of terrible. ?Web developers shouldn't >> have to parse a cookie-string or prepare a properly formated >> set-cookie-string. ?Here's a proposal for an HTML cookie API that >> isn't as terrible: >> >> >> https://docs.google.com/Doc?docid=0AZpchfQ5mBrEZGQ0cDh3YzRfMTRmdHFma21kMg&hl=en >> >> I'd like to propose we include this API in a future version of HTML. >> As always, feedback welcome. >> >> Adam > >
Received on Wednesday, 24 February 2010 11:11:47 UTC