Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 490 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 490 Bytes

Pseudo content

Read the content of a pseudo-element.

Install

npm install pseudo-content

Use

@media (max-width: 414px) {
  #foo:before {
    content: 'mobile';
  }
}
var foo = document.getElementById('foo');

// as second parameter you can pass the pseudo element as string - 'before' or 'after'
var fooPseudoContent = pseudoContent(foo);

console.log(fooPseudoContent.get()); // mobile
console.log(fooPseudoContent.is('mobile')); // true