# apply-selector-and-css

> Setup id, className, and inline css if needed for and HTMLElement based on a selector. Handy for cases where sometimes css maybe applied from an external file or sometimes from inline.css

Latest version **1.1.1** (published 2015-05-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install apply-selector-and-css
pnpm add apply-selector-and-css
yarn add apply-selector-and-css
bun add apply-selector-and-css
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2015-05-04 |
| First published | 2015-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mikko Haapoja |
| Maintainers | mikkoh |
| Keywords | html,element,id,className,css,apply,selector |

## Links

- npm: https://www.npmjs.com/package/apply-selector-and-css
- Repository: https://github.com/Jam3/apply-selector-and-css
- Issues: https://github.com/Jam3/apply-selector-and-css/issues
- npm.io page: https://npm.io/package/apply-selector-and-css

## Dependencies (3)

- [dom-css](https://npm.io/package/dom-css.md) ^1.1.1
- [parse-selector](https://npm.io/package/parse-selector.md) ^1.0.0
- [cssobject-from-selector](https://npm.io/package/cssobject-from-selector.md) ^1.0.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2015-05-04
- 1.1.0 — 2015-04-23
- 1.0.4 — 2015-04-23
- 1.0.3 — 2015-03-31
- 1.0.2 — 2015-03-31
- 1.0.1 — 2015-03-30
- 1.0.0 — 2015-03-30

## README

# apply-selector-and-css

[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

Setup id, className, and css for and HTMLElement. Handy for cases where sometimes css maybe applied from an external file or sometimes from inline.css

## Usage

[![NPM](https://nodei.co/npm/apply-selector-and-css.png)](https://www.npmjs.com/package/apply-selector-and-css)

```javascript
var applySelectorAndCss = require('apply-selector-and-css');

var css =  {
    'div': { width: '100px' },
    '#id': { height: '100px' },
    '.classA.classB': { background: '#F0F' }
};

var apply = applySelectorAndCss(css);

var el1 = document.createElement('div');
var el2 = document.createElement('div');
apply(el1, 'div#id');
apply(el2, '#id2.classSomething')

// el1 would look like this:
// <div id="id" style="width: 100px; height: 100px;"></div>
// 
// el2 would look like this this:
// <div id="id2" class="classSomething"></div>
```

## License

MIT, see [LICENSE.md](http://github.com/Jam3/apply-selector-and-css/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/apply-selector-and-css · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
