searchturbine / phpwee-php-minifier

Open-source (BSD) PHP inline minifier functions for HTML, XHTML, HTML5, CSS 1-3 and Javascript. http://searchturbine.com/php/phpwee
Other
79 stars 46 forks source link

stripping the space from the first href contained in a paragraph tag #12

Open degoya opened 8 years ago

degoya commented 8 years ago

Example:

Ilove fresh bread I<a href="#">love</a> fresh <a href="#">bread</a></p>

Expected result: I love fresh bread I <a href="#">love</a> fresh <a href="#">bread</a></p>

aolin480 commented 8 years ago

Having the same issue as well.. I have <div>Cheese <span>Pizza</span></div>, but it's turning it into <div>Cheese<span>Pizza</span></div>

paullferguson commented 8 years ago

I'm seeing the same with <em> and <a> elements inside <p>

paullferguson commented 8 years ago

Not exactly a fix but I have found commenting out line 88 sorted the issue for me. Thanks to Jeff Blum

aolin480 commented 8 years ago

Good find @paullferguson! I haven't revisited this, but will definitely make a note!

beeb commented 8 years ago

@paullferguson since line 88 is the only line actually doing something, we can comment out lines 74-92.

steoo commented 7 years ago

Same problem here. I think we should make a PR, also with https://github.com/searchturbine/phpwee-php-minifier/issues/18

ashucg commented 7 years ago

Hi everyone, I am late to the party but I think replacing $c->nodeValue = trim($c->nodeValue); with $c->nodeValue = preg_replace('/\s{2,}/im', '', $c->nodeValue); is much better way to fix this issue. What do you guys think?