W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] HTML Cookie API

From: Adam Barth <w3c@adambarth.com>
Date: Wed, 24 Feb 2010 18:08:44 -0800
Message-ID: <5c4444771002241808x186768e8i79089698bea3fcc8@mail.gmail.com>
On Wed, Feb 24, 2010 at 5:00 PM, Nicholas Zakas <nzakas at yahoo-inc.com> wrote:
> Even though there can be multiple cookies with the same name on a single document, this most frequently occurs due to error rather than intention. I've never received a YUI bug report about this occurrence though I have considered returning an array of values instead of just the first value in this case. I might just go do that now. :)
>
> My initial comment still remains: retrieving the value of a single named cookie seems to be a much more common use case than retrieving all cookies. You can choose to solve the duplicate cookie name issue in a number of ways, but not providing a way to access a cookie by name seems like a flaw in this design.

Done.  I've made the API return the first cookie that matches the
specified name.  If a web developer wants to get all the cookies, I've
added a getAllCookies() API.

Adam
Received on Wednesday, 24 February 2010 18:08:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:56 UTC