Skip to content
New issue

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

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

Already on GitHub? # to your account

Error whenn _tagWhitelist missing BODY #17

Open
markusweb opened this issue Jun 15, 2023 · 1 comment
Open

Error whenn _tagWhitelist missing BODY #17

markusweb opened this issue Jun 15, 2023 · 1 comment

Comments

@markusweb
Copy link

i want to have a very restrictive tag list

const _tagWhitelist = { 'A': true, 'B': true, 'BODY': true, 'BR': true, };

but if i remove 'BODY': true, i get an javascript error in console saying

Uncaught TypeError: resultElement.innerHTML is undefined

@lahosken
Copy link

lahosken commented Oct 7, 2023

Maybe a workaround: put body in the content tag white list. (list of tags to replace with DIVs)

This code, in a middle step, turns the input HTML string into a little mini-document with to-be-filtered DOM in its body, even if your HTML string didn't have a body. So when you ask it to ignore body elements, it basically ignores everything.

(Disclaimer: I didn't actually try this workaround; I was doing enough weird stuff such that I ended up writing new code inspired by this. I remember that I needed to handle bodies specially, though)

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

No branches or pull requests

2 participants