const myElement = document.querySelector("q");
const mySelector = "::after";
const cssPseudoElement = myElement.pseudo(mySelector);
const typeOfPseudoElement = cssPseudoElement.type;
console.log(mySelector === typeOfPseudoElement); // Outputs trueCSSPseudoElement: type property / notebook
CSSPseudoElement: type property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.