W3C home > Mailing lists > Public > public-html@w3.org > June 2009

Re: DOMStringMap - get keys, et length?

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 2 Jun 2009 07:59:03 +0000 (UTC)
To: Jeff Schiller <codedread@gmail.com>, Thomas Broyer <t.broyer@gmail.com>
Cc: HTML WG <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0906020758190.11443@hixie.dreamhostps.com>
On Wed, 6 Aug 2008, Jeff Schiller wrote:
> 
> I think there should be a way to get a collection of key names from the 
> DOMStringMap [1].  How about adding a fourth method to this interface:
> 
> DOMStringList keys();  // XXX4 ?
> 
> Where this returns a DOMStringList [2] of keys (with no specification on 
> the order of keys, of course).

You can now do this just by iterating over the object itself.


> Also, I seem to remember seeing text in the HTML5 spec to the effect 
> that:
> 
> <span id="foo" data-bar="baz" />
>   alert( document.getElementById("foo").dataset.bar );
> 
> would spit out "baz".  I guess this was removed in favor of the 
> DOMStringMap interface?  If so, why?  Sorry, I know this must have been 
> discussed so a simple pointer to the discussion is fine.

On Wed, 6 Aug 2008, Thomas Broyer wrote:

> dataset is a DOMStringMap, which defines XXX1 as a [NameGetter], so 
> dataset.bar is equivalent to dataset.XXX1("bar")

Thomas is correct, except that the methods have been removed and it's all 
implicit now.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 2 June 2009 07:59:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:38 GMT