Skip to content

Commit

Permalink
Merge pull request #41 from websharks/feature/39b
Browse files Browse the repository at this point in the history
Bug fix; hanging `-->`. See: #39
  • Loading branch information
JasWSInc committed Sep 2, 2014
2 parents 1b7aad8 + 02ce087 commit 50b1d8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion html-compressor/includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ protected function compile_js_tag_frags_into_parts(array $js_tag_frags)
* Else an empty array (i.e. no CSS tag fragments in the HTML fragment array).
*
* @see http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
* @see http://stackoverflow.com/a/12102131
*/
protected function get_css_tag_frags(array $html_frag)
{
Expand Down Expand Up @@ -880,6 +881,7 @@ protected function get_css_tag_frags(array $html_frag)
* Else an empty array (i.e. no JS tag fragments in the HTML fragment array).
*
* @see http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
* @see http://stackoverflow.com/a/12102131
*/
protected function get_js_tag_frags(array $html_frag)
{
Expand Down Expand Up @@ -1433,6 +1435,8 @@ protected function maybe_compress_html_code($html)
* @return string Compressed HTML markup. With all comments and extra whitespace removed as quickly as possible.
* This preserves portions of HTML that depend on whitespace. Like `pre/code/script/style/textarea` tags.
* It also preserves conditional comments and JavaScript `on(click|blur|etc)` attributes.
*
* @see http://stackoverflow.com/a/12102131
*/
protected function compress_html($html)
{
Expand All @@ -1451,7 +1455,7 @@ protected function compress_html($html)
$static['preservations'] = // Implode for regex capture.
'/(?P<preservation>'.implode('|', $static['preservations']).')/is';

$static['compressions']['remove_html_comments'] = '/\<\!(?!DOCTYPE)[^>]*?\>/i';
$static['compressions']['remove_html_comments'] = '/\<\!\-{2}.*?\-{2}\>/is';
$static['compress_with']['remove_html_comments'] = '';

$static['compressions']['remove_extra_whitespace'] = '/\s+/';
Expand Down

0 comments on commit 50b1d8a

Please sign in to comment.