Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h1><a href="https://developer.mozilla.org/en/docs/Web/API/Window/getComputedStyle" rel="nofollow noreferrer"><code>window.getComputedStyle( element[, pseudoElt] )</code></a></h1> <blockquote> <p><code>pseudoElt</code> Optional</p> <p>A string specifying the pseudo-element to match. Must be omitted (or null) for regular elements. Pseudo-classes can be specified like ":focus".</p> </blockquote> <p>I'm possibly misunderstanding what you're trying to accomplish, but here's some JavaScript to play with. I hope it's useful.</p> <p>It iterates through every element in the document and attempts to get the <code>content</code> of its <code>:before</code>s and <code>:after</code>s.<br> If it finds any, it outputs the details to the <code>console</code>.<br> Simple, but demonstrable.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>document.querySelectorAll( "*" ).forEach( ( e ) =&gt; { const ebc = window.getComputedStyle( e, ":before" ).content, eac = window.getComputedStyle( e, ":after" ).content; if ( ebc || eac ) { console.log( e ); console.log( ( ebc ? "Before content = " + ebc : "No :before content" ) ); console.log( ( eac ? "After content = " + eac : "No :after content" ) ); } } );</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>div:before { content: "This is a test."; } p:after { content: attr( data-content ); } span:after { content: " dolor"; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt; &lt;p data-content="&amp;hellip;"&gt;Lorem &lt;span&gt;ipsum&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload