1.0.4 • Published 6 years ago
get-pseudo-content v1.0.4
get-pseudo-content
Returns a string as rendered from the content attribute of a pseudo element.
Installation
npm install --save-dev get-pseudo-content
Example
import getPseudoContent from "get-pseudo-content";
getPseudoContent(document.body, "::before");
Supports
- string
attr()
Differences in raw output between browser
Blink | Webkit | Gecko | Trident | |
---|---|---|---|---|
encloses single strings | yes | no | yes | yes |
combines multiple strings | yes | yes | no | no |
returns line breaks as \a | yes | yes | yes | no |
returns line breaks as new lineseven when rendered on a single line | no | no | no | yes |
renders attr() as actual string | yes | yes | no | no |
escapes " | yes | yes | yes | no |
🐛 Edge: Failing to escape
"
When a double quote is preceded with a space, this library is unable return the correct value. Related bug report: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20351981/