Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refresh() does not add CSS classes #123

Open
sqwk opened this issue Jan 10, 2024 · 0 comments
Open

refresh() does not add CSS classes #123

sqwk opened this issue Jan 10, 2024 · 0 comments

Comments

@sqwk
Copy link

sqwk commented Jan 10, 2024

I am checking if new elements have been been added to the DOM to call refresh():

    const solutionList = document.getElementById('solution-list');
    if (solutionList != null) {
        const observer = new MutationObserver((mutations) => {
            mutations.forEach((mutation) => {
                mutation.addedNodes.forEach((addedNode) => {
                    if (addedNode.nodeName != "#text") {
                        BackgroundCheck.refresh((addedNode as HTMLElement).querySelector('.solution-title'));
                    }
                });
            });
        });
        observer.observe(solutionList, { childList: true, subtree: true });
    }

Neither BackgroundCheck.refresh() or BackgroundCheck.refresh(target) add the needed classes to the targets. Instead I get Uncaught [object HTMLHeadingElement] is not a target in the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant