1.0.4 • Published 5 years ago

get-pseudo-content v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

get-pseudo-content

npm dev dependencies browserstack


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

BlinkWebkitGeckoTrident
encloses single stringsyesnoyesyes
combines multiple stringsyesyesnono
returns line breaks as \ayesyesyesno
returns line breaks as new lineseven when rendered on a single linenononoyes
renders attr() as actual stringyesyesnono
escapes "yesyesyesno

🐛 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/

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago