Intent to Implement/Ship
========================
Make the named properties in HTMLCollection and HTMLAllCollection (as
well as IDL interfaces that inherit from them, namely
HTMLOptionsCollection and HTMLFormControlsCollection) not enumerable.
Contact emails
==============
raphael.ku...@intel.com
Specs
=====
https://dom.spec.whatwg.org/#interface-htmlcollection
https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#the-htmlallcollection-interface
Summary
=======
The [LegacyUnenumerableNamedProperties] extended attribute was added to
WebIDL in early 2016 with
https://github.com/heycam/webidl/pull/91.
It was then added to HTMLCollection and HTMLAllCollection in the
following commits:
https://github.com/whatwg/dom/commit/742e8c15312ae447580d2fd5498a02d0902d5ff3
https://github.com/whatwg/html/commit/07f6c7f058c57d582db1aced6741cea1ed63ccf7
Even before that, those interfaces' named properties were declared not
enumerable back in 2014:
https://github.com/whatwg/dom/commit/c812a0aafaa92460ffdd333418e03f2790fa742a
https://github.com/whatwg/html/commit/c1de4765a8ba3671cbb70a34cf5bdf3ee93572c6
Note that these commits also add the [LUNP] extended attribute to other
interfaces; I'm tackling them separately and not including them in this
CL because we were already trying to achieve the same thing there with
the non-standard [NotEnumerable] attribute. HTML{All}Collection are the
exceptions that need an Intent thread.
When used in an IDL interface, it makes all its named properties
unenumerable. User-visible effects of this change include:
- These properties are skipped by calls to Object.keys(),
Object.values() and Object.entries() as well as for-in loops.
- Calling Object.getOwnPropertyDescriptor() will return a descriptor
with its "enumerable" property set to false.
Object.getOwnPropertyDescriptors() and Object.getOwnPropertyNames()
continue to include these named properties just like before, as they are
not affected by the enumerability of a given property.
Motivation
==========
Interoperability with other engines and spec compliance. Like I said
above, some of our IDL interfaces (NamedNodeMap, for example) already
behaved almost like the spec mandated while others such as
HTMLCollection did not, which leads to unnecessary confusion.
Interoperability risk
=====================
Edge:
- EdgeHTML 14.14393 still marks HTMLCollection's named properties as
enumerable. According to wpt.fyi, this hasn't changed in Edge 15. It
is unclear if there is work on it.
Firefox:
- Has shipped with [LegacyUnenumerableNamedProperties] since Firefox 49.
https://bugzilla.mozilla.org/show_bug.cgi?id=1270349
- Made HTMLAllCollection's properties unenumerable in Firefox 32 (at
least).
https://bugzilla.mozilla.org/show_bug.cgi?id=874212
- Made HTMLCollection's properties unenumerable in Firefox 31.
https://bugzilla.mozilla.org/show_bug.cgi?id=843840
WebKit:
- Added [LegacyUnenumerableNamedProperties] to its IDLs in Jan 2017.
https://trac.webkit.org/changeset/210667/webkit
- I don't have a Mac at hand to properly test this right now, but I can
see some code making named properties default to not enumerable from
2015 and 2013 (my Perl- and JSC-fu aren't very good though).
https://trac.webkit.org/changeset/154253/webkit
https://trac.webkit.org/changeset/188663/webkit
Compatibility risk
==================
On the one hand, there are no measurements in place to check if anyone's
relying on those named properties being enumerable even though they
should not have been enumerable since 2014, which can bring another
flood of angry emails like the XHR.getAllResponseHeaders() issue we had
with M60.
On the other hand, it looks like both Gecko and WebKit have done this
for years now, in a way or another.
Will this feature be supported on all six Blink platforms?
==========================================================
Yes.
Is this feature fully tested by web-platform-tests?
===================================================
Yes.
Tracking bug(s)
===============
https://bugs.chromium.org/p/chromium/issues/detail?id=703990
https://bugs.chromium.org/p/chromium/issues/detail?id=719703
Requesting approval to ship?
============================
Yes, hopefully in M63; I'll also add a
chromestatus.com entry about this
if this intent's approved.