0.0.5 • Published 2 years ago
@aquaticat/create-element-from-selector v0.0.5
createElementFromSelector
Create an HTMLElement from CSS selectors.
Install
One of:
npm
npm install @aquaticat/create-element-from-selector
yarn
yarn add @aquaticat/create-element-from-selector
pnpm
pnpm add @aquaticat/create-element-from-selector
Use
import createElementFromSelector from '@aquaticat/create-element-from-selector';
Profit
Example JavaScript code:
document.body.appendChild(createElementFromSelector('a[autofocus].many.thanks[href="https://aquati.cat"]#Author_of_createElementFromSelector'));
Would result in expected HTML:
<html>
<body>
<a autofocus class="many thanks" href="https://aquati.cat" id="Author_of_createElementFromSelector"></a>
</body>
</html>