# dom-shortener

> A package to help simplify the DOM's document and some of its methods.

Latest version **0.2.2** (published 2022-08-02) · SEE LICENSE IN LICENSE.md license · 0 weekly downloads

## Install

```sh
npm install dom-shortener
pnpm add dom-shortener
yarn add dom-shortener
bun add dom-shortener
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2022-08-02 |
| First published | 2022-08-01 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE.md |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | JavRedstone |
| Maintainers | javredstone |
| Keywords | dom, document, shortener, dom methods, dom shortener, html, frontend, front end, npm, package, javredstone |

## Links

- npm: https://www.npmjs.com/package/dom-shortener
- Repository: https://github.com/JavRedstone/dom-shortener
- Homepage: https://github.com/JavRedstone/dom-shortener#readme
- Issues: https://github.com/JavRedstone/dom-shortener/issues
- npm.io page: https://npm.io/package/dom-shortener

## 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

- 0.2.2 (latest) — 2022-08-02
- 0.2.1 — 2022-08-02
- 0.2.0 — 2022-08-02
- 0.1.5 — 2022-08-02
- 0.1.4 — 2022-08-02
- 0.1.3 — 2022-08-01
- 0.1.2 — 2022-08-01
- 0.1.1 — 2022-08-01
- 0.1.0 — 2022-08-01

## README

# DOM Shortener `v0.2.2`

## What is it?

A package to help simplify the DOM's `document` and some of its methods.

## Installation

Using [npm](https://www.npmjs.com/), go to your terminal and type:

```bash
$ npm install dom-shortener
```

And that's it!

## Usage

### index.html

```html
<!DOCTYPE html>
<html>
    <head>
        <!-- DO NOT PLACE SCRIPT HERE (DOM ELEMENTS NOT LOADED) -->
    </head>
    <body>
        <div id="hello">Hello</div>

        <div class="hello-world">Hello World 1</div>
        <div class="hello-world">Hello World 2</div>
        <div class="hello-world">Hello World 3</div>
        <div class="hello-world">Hello World 4</div>
        <div class="hello-world">Hello World 5</div>

        <!-- PLACE IT HERE INSTEAD -->
        <script src="bundle.js"></script>
    </body>
</html>
```

### index.js

```js
let DOC = require('dom-shortener');

// Native document method
DOC.write('<h1>DOM SHORTENER DEMO</h1>');

// DOM shortened methods
let helloEl = DOC.getById('hello');
let helloWorldEls = DOC.getByClass('hello-world');

// Can be manipulated just fine
helloEl.innerHTML = 'Hello Shortened';
for (let helloWorldEl of helloWorldEls) {
    helloWorldEl.style.backgroundColor = 'red';
}
```

After you're done, bundle for the browser with [browserify](https://browserify.org/).
**Note that index.html has a script with the source being the bundled file.**

### End Result

<img src="https://raw.githubusercontent.com/JavRedstone/dom-shortener/main/result.png">

## Suggestions

**Please fill out this [form](https://docs.google.com/forms/d/e/1FAIpQLSfR1ZBUBdHXGkOmdZyKpPlqXWkiU29XeKR-aeK9cUq1wucpZg/viewform) if you have any suggestions since I am actively updating this package in real time**

If you liked this package, you can **star** my [Github Repository](https://github.com/JavRedstone/dom-shortener) if you wish. If you found any bugs, please report them [here](https://github.com/JavRedstone/dom-shortener/issues), and I will fix them as fast as I can.

## License

MIT License

Copyright (c) 2022 JavRedstone

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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