diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-14 11:53:09 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-14 11:53:09 +0530 |
| commit | 1393f99b39906f85689f7781da188e6fb414eaf6 (patch) | |
| tree | d93096f5974926dd7ceccc3e43fd25df3681b324 /src/utils/replace-attributes.ts | |
| parent | a30b28d40e5bacdbbbcad3c9de8f1fe3e083119c (diff) | |
| download | banglar-bhumi-utils-1393f99b39906f85689f7781da188e6fb414eaf6.tar.gz banglar-bhumi-utils-1393f99b39906f85689f7781da188e6fb414eaf6.zip | |
Added some style changes.
Diffstat (limited to 'src/utils/replace-attributes.ts')
| -rw-r--r-- | src/utils/replace-attributes.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/utils/replace-attributes.ts b/src/utils/replace-attributes.ts deleted file mode 100644 index 443c1d0..0000000 --- a/src/utils/replace-attributes.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { observeDOM } from "@/utils/observe-dom"; - -export const replaceAttributes = (elements: any[]) => { - let count = 0; - - observeDOM(() => { - for (let i = 0; i < elements.length; i++) { - if (elements[i]) { - const element = document.querySelector(elements[i]![0]) as HTMLElement | null; - if (element) { - const attributes = elements[i]![1]; - if (attributes.innerHTML) { - element.innerHTML = attributes.innerHTML; - } - delete attributes.innerHTML; - for (const attribute in attributes) { - if (attributes[attribute] === null) { - element.removeAttribute(attribute); - } else { - element.setAttribute(attribute, attributes[attribute]); - } - } - elements[i] = undefined; - count++; - if (count >= elements.length) { - return true; - } - } - } - } - - return false; - }); -}; |
