Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
patelka2211 committed Jun 23, 2023
1 parent b95c6c0 commit 48fd6be
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Dominar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ Visit [https://patelka2211.github.io/dominar/](https://patelka2211.github.io/dom
## Installation

[![npm (scoped)](https://img.shields.io/npm/v/@patelka2211/dominar)](https://www.npmjs.com/package/@patelka2211/dominar)
[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@patelka2211/dominar)](https://bundlephobia.com/package/@patelka2211/[email protected].1)
[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@patelka2211/dominar)](https://bundlephobia.com/package/@patelka2211/[email protected].2)
[![npm](https://img.shields.io/npm/dy/@patelka2211/dominar)](https://www.npmjs.com/package/@patelka2211/dominar)
[![jsDelivr hits (npm scoped)](https://img.shields.io/jsdelivr/gh/hy/patelka2211/dominar)](https://cdn.jsdelivr.net/gh/patelka2211/[email protected].1/)
[![jsDelivr hits (npm scoped)](https://img.shields.io/jsdelivr/gh/hy/patelka2211/dominar)](https://cdn.jsdelivr.net/gh/patelka2211/[email protected].2/)

To install Dominar using npm, run the following command:

```sh
npm i @patelka2211/dominar
```

Alternatively, you can include [Dominar's IIFE file](https://cdn.jsdelivr.net/gh/patelka2211/[email protected].1/Dominar.js) in your website using a `<script>` tag:
Alternatively, you can include [Dominar's IIFE file](https://cdn.jsdelivr.net/gh/patelka2211/[email protected].2/Dominar.js) in your website using a `<script>` tag:

```html
<script
async
src="https://cdn.jsdelivr.net/gh/patelka2211/[email protected].1/Dominar.js"
src="https://cdn.jsdelivr.net/gh/patelka2211/[email protected].2/Dominar.js"
></script>
```

Expand Down Expand Up @@ -91,12 +91,12 @@ addEventListeners(document.body, {

### When included as a `<script>` tag in a website.

If the script tag is not already included in the `<head>` tag, please add the following script tag to include [Dominar's IIFE JavaScript](https://cdn.jsdelivr.net/gh/patelka2211/[email protected].1/Dominar.js) file.
If the script tag is not already included in the `<head>` tag, please add the following script tag to include [Dominar's IIFE JavaScript](https://cdn.jsdelivr.net/gh/patelka2211/[email protected].2/Dominar.js) file.

```html
<script
async
src="https://cdn.jsdelivr.net/gh/patelka2211/[email protected].1/Dominar.js"
src="https://cdn.jsdelivr.net/gh/patelka2211/[email protected].2/Dominar.js"
></script>
```

Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dominar by KP</title>
<title>Dominar from KPVERSE</title>

<link
rel="shortcut icon"
Expand All @@ -20,7 +20,7 @@
<link rel="stylesheet" href="./website-stuff/css/style.css" />

<!-- Primary Meta Tags -->
<meta name="title" content="Dominar by KP" />
<meta name="title" content="Dominar from KPVERSE" />
<meta
name="description"
content="Dominar is a powerful library designed to make it easy for developers to manipulate the Document Object Model (DOM) and create dynamic HTML content. Dominar empowers you to take control of your web development projects like a pro. Unleash the power to dominate the DOM with Dominar."
Expand All @@ -32,7 +32,7 @@
property="og:url"
content="https://patelka2211.github.io/dominar"
/>
<meta property="og:title" content="Dominar by KP" />
<meta property="og:title" content="Dominar from KPVERSE" />
<meta
property="og:description"
content="Dominar is a powerful library designed to make it easy for developers to manipulate the Document Object Model (DOM) and create dynamic HTML content. Dominar empowers you to take control of your web development projects like a pro. Unleash the power to dominate the DOM with Dominar."
Expand All @@ -48,7 +48,7 @@
property="twitter:url"
content="https://patelka2211.github.io/dominar"
/>
<meta property="twitter:title" content="Dominar by KP" />
<meta property="twitter:title" content="Dominar from KPVERSE" />
<meta
property="twitter:description"
content="Dominar is a powerful library designed to make it easy for developers to manipulate the Document Object Model (DOM) and create dynamic HTML content. Dominar empowers you to take control of your web development projects like a pro. Unleash the power to dominate the DOM with Dominar."
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@patelka2211/dominar",
"version": "1.2.1",
"version": "1.2.2",
"description": "Dominar is a powerful library designed to make it easy for developers to manipulate the Document Object Model (DOM) and create dynamic HTML content. Dominar empowers you to take control of your web development projects like a pro. Unleash the power to dominate the DOM with Dominar.",
"main": "index.js",
"module": "index.js",
Expand All @@ -27,7 +27,6 @@
"Dominar from KPVERSE",
"Dominar.js",
"KPVERSE",
"Dominar by KP",
"Developed by KP",
"Kartavya Patel",
"patelka2211",
Expand Down
13 changes: 10 additions & 3 deletions src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ async function render(
): Promise<void> {
let { clearBeforeRender, insertType } = options;

if (clearBeforeRender === undefined) clearBeforeRender = true;
if (clearBeforeRender === true) root.innerHTML = "";
if (typeof clearBeforeRender !== "boolean") clearBeforeRender = true;

if (clearBeforeRender === true || insertType === undefined)
if (clearBeforeRender === true) {
root.innerHTML = "";
insertType = "append";
}

if (insertType === undefined) insertType = "append";

if (insertType !== "append" && insertType !== "prepend")
throw Error(
`'insertType' in options can be 'append' or 'prepend' but not '${insertType}'.`
);
insertChildren(root, children, insertType);
}

Expand Down
9 changes: 3 additions & 6 deletions src/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ function insertChildren(
root[insertType](children.renderedTag);
else if (children instanceof DominarTagList) {
let renderedTagList = children.renderedTagList,
multiplier1 = insertType === "append" ? 0 : 1,
multiplier2 = insertType === "append" ? 1 : -1;

for (let index = 0; index < renderedTagList.length; index++) {
tagListLength = renderedTagList.length;
for (let index = 0; index < tagListLength; index++) {
root[insertType](
renderedTagList[
(renderedTagList.length - 1) * multiplier1 +
index * multiplier2
insertType === "append" ? index : tagListLength - 1 - index
]
);
}
Expand Down

0 comments on commit 48fd6be

Please sign in to comment.