This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21986 - AttrExodus: Element.attributes needs to have a named getter
Summary: AttrExodus: Element.attributes needs to have a named getter
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-09 15:36 UTC by Ms2ger
Modified: 2014-08-18 11:21 UTC (History)
5 users (show)

See Also:


Attachments

Description Ms2ger 2013-05-09 15:36:58 UTC
We broke this (intermittently) and got noticed:

https://bugzilla.mozilla.org/show_bug.cgi?id=869796
https://bugzilla.mozilla.org/show_bug.cgi?id=868834
Comment 1 Anne 2013-05-30 05:38:07 UTC
*sad panda*
Comment 2 Anne 2013-07-09 15:54:28 UTC
Okay, so what interface should we introduce here?

http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1780488922 is the original solution.

I called it AttrList as it's clearly not a Map in the JavaScript sense. I removed the methods that did not seem needed, but maybe they are?

interface AttrList {
  getter Attr (DOMString name);
  getter Attr item(unsigned long index);
  unsigned long length;
}

I guess because of the named getter adding ArrayClass would be problematic.
Comment 3 Anne 2013-07-09 16:07:20 UTC
http://mxr.mozilla.org/mozilla-central/source/dom/webidl/MozNamedAttrMap.webidl note the ? after Attr in particular.
Comment 4 Philip Jägenstedt 2014-03-25 16:56:07 UTC
If the interface needs to stay, why bother changing the name?
Comment 5 Anne 2014-03-25 17:06:53 UTC
You want to keep the name NamedNodeMap from DOM Level 3 Core?
Comment 6 Philip Jägenstedt 2014-03-25 17:25:03 UTC
I don't feel strongly about it, just curious. In order to determine which bits of the API need to stay I just sent this review for more use counters in Blink:
https://codereview.chromium.org/211363003
Comment 7 Anne 2014-03-25 18:07:55 UTC
Mainly since if we are keeping this API around and it is being exposed to the web, we might as well try to keep it somewhat sane.
Comment 8 Philip Jägenstedt 2014-03-25 18:28:35 UTC
Unfortunately it currently doesn't seem possibly to count access to the interface object itself (e.g. using x instanceof NamedNodeMap) so I can't tell if changing it is safe. It seems fairly likely to be safe, though.

Anyway, the use counters have landed now, data will show up here:

NamedNodeMapGetNamedItem: http://www.chromestatus.com/metrics/feature/timeline/popularity/306
NamedNodeMapSetNamedItem: http://www.chromestatus.com/metrics/feature/timeline/popularity/307
NamedNodeMapRemoveNamedItem: http://www.chromestatus.com/metrics/feature/timeline/popularity/308
NamedNodeMapItem: http://www.chromestatus.com/metrics/feature/timeline/popularity/309
NamedNodeMapGetNamedItemNS: http://www.chromestatus.com/metrics/feature/timeline/popularity/310
NamedNodeMapSetNamedItemNS: http://www.chromestatus.com/metrics/feature/timeline/popularity/311
NamedNodeMapRemoveNamedItemNS: http://www.chromestatus.com/metrics/feature/timeline/popularity/312
Comment 9 Anne 2014-08-18 11:21:43 UTC
Philip, that seems encouraging. I added get/remove as well as their NS counterparts since we are stuck with namespaced attributes I think. I did not add the methods that deal with Attr objects since those would require a link between Attr objects and elements and that would be sad as you pointed out.

https://github.com/whatwg/dom/commit/8af48267390b971a2ac02c7005ba42c08264b7e1

New issues in new bugs I guess.