Have a look at this page's source code to see the additions to the DOM for working with pseudo-elements.
window.getPseudoElements(element, type)
can be used to get a list of an element's pseudo-elements where:
element
is a reference to the host DOM elementtype
is either "before"
or "after"
and represents the type of the pseudo-elementsThe demo works correctly if both the 'control' and 'pseudo-elements' sections look exactly the same. Take a look at the source code.