-
Notifications
You must be signed in to change notification settings - Fork 569
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
a bug with removeComments&&ignoreCustomFragments #511
Comments
I'm confused - why should |
@alexlamsl ? this include ignoreCustomComments comment can't be removed, if it removed, it will cause the ignoreCustomComments replace back logic error. |
Bear with my confused soul... 😰 Would you mind giving an example of html code (and options) that would produce an unexpected result? |
Ah, I see what you mean now - when Just to be clear, is the following output what you'd expect instead?
|
@alexlamsl yes |
ok - will have a look at it 👍 @kangax this bug / corner case exists since |
@kath4job for the future, it would be best to phrase an issue like this by simply stating that It's an interesting use case and I think the right outcome here is for minifier to strip a comment:
Even though "ignoreCustomFragments" is on, we can't be aware of an outer context. If we try to parse input as HTML first — to be aware of the context — then we run into the issue of that markup not being valid HTML due to the presence of all that stuff that has to be ignored, and the entire parsing process goes to hell. It's a catch 22. For this reason, we can only ignore custom fragments as the very first step of minification, before trying to parse/minify anything. After that, We should definitely mention this in the docs but I think this is the correct behavior. @kath4job @alexlamsl what do you think? Does this make sense? Is there anything else we can do without shooting ourselves in the foot? |
@kangax in terms of expected behaviour we are on the same page. You might already know, but just in case I'd like to clarify that the bug is not just comment being removed. It is this:
getting turned into this:
due to the assumption of sequential replacement. I have an idea to fix this (the suggested fix above doesn't give our expected outcome...) - will post as soon as I'm back to a real keyboard. |
Yep, I figured that. Thanks for taking care of it! Sent from my iPad
|
when deciding whether to ignore this comment, the "text" has been replaced by "reCustomIgnore".
so this logic will never retrn true, this comment will be removed and cause some problems. my point of view, this function should be according to the following:
The text was updated successfully, but these errors were encountered: