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

filterElements doesn't work #84

Open
mj4444 opened this issue Jun 18, 2020 · 0 comments
Open

filterElements doesn't work #84

mj4444 opened this issue Jun 18, 2020 · 0 comments

Comments

@mj4444
Copy link

mj4444 commented Jun 18, 2020

I want to exclude some DOM elements based on some class.
For this I used filterElements:-

findAndReplaceDOMText(container, {
    filterElements: function(el) {
       if (el.className) {
            return el.className.indexOf('test') === -1;
        }
    },
    find: regex,
    replace: function(portion, match) {
        called = true;
        var el = document.createElement('span');
        el.className = 'custom_highlight';
        el.innerHTML = portion.text;
        return el;
    },
});
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