These functions help work with element content.


substantiveElements(nodes) static method

Return a set of Elements which are likely to be useful as component content.

Given a NodeList or array of objects, this will return only those array members that are: a) instances of Element (HTMLElement or SVGElement), and b) not on a blacklist of normally invisible elements (such as style or script). Among other things, this filters out Text nodes.

This is used by ContentItemsMixin to filter out nodes which are unlikely to be interesting as list items. This is intended to satisfy the Gold Standard checklist criteria Auxiliary Content, so that a component does not inadvertently treat <style> and other invisible items as element content.

  • nodes: NodeListthe list of nodes to filter

Returns: Array. the filtered elements