Closed gauravmuk closed 7 years ago
When HTML contains JavaScript, the JavaScript part cannot be properly processed, because for that it needs to be loaded into the JavaScript parser, which in this case is impossible, that's why it wasn't supported from the beginning.
Your change will break the parser output when it encounters certain regular expressions inside JavaScript that's inside HTML.
Therefore, you cannot process an HTML as both HTML and JavaScript at the same time.
What should be done in such cases when the html file has some js?
What should be done in such cases when the html file has some js?
In the context of this library - nothing. You would need to pull each JavaScript block from the HTML, load it into the JavaScript parser, process it separately, then re-inject back into the HTML. And this task alone would be more complex than the entire library now, so not worth doing.
Thanks for the suggestion. I should close the PR then since this already created problems?
Yep.
This was done to support cases when html might have javascript code as well, appended script tag.