Darkmode.js icon indicating copy to clipboard operation
Darkmode.js copied to clipboard

createElement at runtime

Open messizqin opened this issue 3 years ago • 0 comments

Hi there, thanks very much for making this awesome project. I have a request if I may. I use javascript to create Dom element at runtime, and tries to apply dark mode on it after created.

let darkmode = new Darkmode(options);
let el = document.createElement('div');
el.style.width = '200px';
el.style.height = '200px';
el.style.background = 'red';
document.body.appendChild(el);
darkmode.toggle();

however, createElement will not be rendered. in my project, I create a lot of element through javascript at runtime, I wonder if there is a way I can get the entire page rendered including elements those created by javascript.

messizqin avatar Jan 10 '22 09:01 messizqin