This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

getElementsByClassName

Summary

Just like Document/getElementsByClassName except that it only works within the scope of this ShadowRoot’s shadow tree.

Method of dom/shadowdom/ShadowRootdom/shadowdom/ShadowRoot

Syntax

var result = element.getElementsByClassName(classNames);

Parameters

classNames

Data-type
String

A space separated list of classes.

Return Value

Returns an object of type ObjectObject

A live HTMLCollection of elements with the given class names.

Notes

Use of this method is discouraged. See HTMLCollection. However, that article has not been vetted for vendor bias, it is an unreviewed import, and the performance implications described may be browser (IE) specific.