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

🐛 [BUG] - is_themecore hookActionOutputHTMLBefore broken html output #371

Open
tomasz3k opened this issue Jan 16, 2024 · 2 comments
Open
Labels
bug Something isn't working is_themecore

Comments

@tomasz3k
Copy link

Description

I just came out with error when I write template file with <script>let test = '<div></div>';</script>
Your hook changed it to <script>let test = '<div></script></section></div>';</script> and browser throwed error Uncaught SyntaxError: Invalid or unexpected token
I spend hour to find out solution.

Node.js version

v20.10.0

php version

8.1

OS and it's version

MacOs 14.2.1 (23C71)

Browsers

Chrome

Required module/theme

is_themecore

Reproduction steps

Change 
` $doc->loadHTML(
            '<meta http-equiv="Content-Type" content="charset=utf-8">' . $html,
            LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD 
        );` 

to 
` $doc->loadHTML(
            '<meta http-equiv="Content-Type" content="charset=utf-8">' . $html,
            LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_SCHEMA_CREATE
        );`

Logs

No response

@tomasz3k tomasz3k added the bug Something isn't working label Jan 16, 2024
@Oksydan
Copy link
Owner

Oksydan commented Jan 17, 2024

Hi @tomasz3k,

thank you for creating an issue.
I was able to reproduce the problem. I am adding this to is_themecore roadmap.
We came across a lot of problems with DOMDocument. I am not sure but we might get rid of it in is_themecore v5.

@tomasz3k
Copy link
Author

I think there should be better way to manipulate HTML. DomDocument is easy but not best. It requires many extra flags to works as expected so it's platform dependant too. I am not sure is it the fastest way to manipulate DOM? Maybe you should just use some regex? It will require extra time for tests. Have a nice day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working is_themecore
Projects
Development

No branches or pull requests

2 participants