Intent to Deprecate: ShadowRoot.getElementsBy*()

Skip to first unread message

Philip Jägenstedt

Dec 12, 2014, 3:10:12 PM12/12/14
to blink-dev

Primary eng (and PM) emails


Deprecate getElementsByClassName(), getElementsByTagName() and getElementsByTagNameNS() on ShadowRoot.

Note: getElementById() is not involved in any way.


Follow the links for more context. In summary, this was agreed upon a year ago, and it came up again when I suggested moving these functions to ParentNode, the common interface of Document, DocumentFragment and Element. That probably won't happen, but the fate of these on ShadowRoot is a mostly separate concern.

The spec is and I trust Dimitri or Hayato will update it some time before these are eventually removed, if that's the outcome.

Compatibility Risk

Any content using these methods will throw exceptions.

Alternative implementation suggestion for web developers

getElementsByClassName('foo') becomes querySelectorAll('.foo')

getElementsByTagName('foo') becomes querySelectorAll('foo')

getElementsByTagNameNS(...) becomes querySelectorAll('...|...')

Usage information from UseCounter

There are none. I suggest adding the use counters with DeprecateAs= directly because usage is likely low enough to not amount to console spam and this saves a release cycle of waiting.

Entry on,, or MDN

Requesting approval to remove too?

No, wait until the deprecation and thus the use counters have reached stable and evaluate the compat risk at that time.

Dimitri Glazkov

Dec 12, 2014, 4:26:43 PM12/12/14
to Philip Jägenstedt, blink-dev

Chris Harrelson

Dec 12, 2014, 8:17:20 PM12/12/14
to Dimitri Glazkov, Philip Jägenstedt, blink-dev

To unsubscribe from this group and stop receiving emails from it, send an email to

Hayato Ito

Dec 13, 2014, 4:36:40 AM12/13/14
to Chris Harrelson, Dimitri Glazkov, Philip Jägenstedt, blink-dev
Non-API-owner LGTM.

l'll remove it from the Shadow DOM spec. We can assume that these are removed from the spec in a few days.
I'll add use counter for these APIs if we get enough LGTM here.

Philip Jägenstedt

Dec 13, 2014, 4:53:32 AM12/13/14
to Hayato Ito, blink-dev, Dimitri Glazkov, Chris Harrelson

Hayato, if you want to take care of the use counters and deprecation, please go ahead. Deprecation does not require LGTMs, but here's a third one: LGTM.

Reply all
Reply to author
Message has been deleted
0 new messages