Skip to content

Commit abcbfad

Browse files
Ulysse ARNAUDUlysse ARNAUD
authored andcommitted
0.3.3
1 parent a0914b7 commit abcbfad

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
function init() {
2-
32
function getAllEventsNames() {
43
const events = Array.from(Object.keys(window).filter(key => /^on/.test(key)).map(e => e.slice(2)));
54
events.push('hover');
@@ -32,11 +31,6 @@ function init() {
3231
return path.join('>');
3332
}
3433

35-
const EVENTS = getAllEventsNames();
36-
const ELEMENTS_TAGS = getAllElementsTagsNames();
37-
38-
document.addEventListener('DOMContentLoaded', main);
39-
4034
function main() {
4135
const elements = document.querySelectorAll('[class*="["]');
4236
const regularExpressionsComments = [
@@ -162,5 +156,11 @@ function init() {
162156
document.dispatchEvent(event);
163157
}
164158

159+
const EVENTS = getAllEventsNames();
160+
const ELEMENTS_TAGS = getAllElementsTagsNames();
161+
162+
main();
165163
}
166-
window.CSSinJSinHTML = { init };
164+
document.addEventListener('DOMContentLoaded', init);
165+
const observer = new MutationObserver(init);
166+
observer.observe(document, { attributes: true, childList: true, subtree: true });

0 commit comments

Comments
 (0)