You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pagespeed.apache.org by GitBox <gi...@apache.org> on 2018/06/03 21:09:25 UTC

[GitHub] jmarantz closed pull request #1774: Add to sensitive tags in collapse_whitespace_filter.

jmarantz closed pull request #1774: Add <code> to sensitive tags in collapse_whitespace_filter.
URL: https://github.com/apache/incubator-pagespeed-mod/pull/1774
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pagespeed/kernel/html/collapse_whitespace_filter.cc b/pagespeed/kernel/html/collapse_whitespace_filter.cc
index 03a3d175e..c2bcb477c 100644
--- a/pagespeed/kernel/html/collapse_whitespace_filter.cc
+++ b/pagespeed/kernel/html/collapse_whitespace_filter.cc
@@ -39,7 +39,7 @@ namespace {
 // Tags within which we should never try to collapse whitespace (note that this
 // is not _quite_ the same thing as kLiteralTags in html_lexer.cc):
 const HtmlName::Keyword kSensitiveTags[] = {
-  HtmlName::kPre, HtmlName::kScript, HtmlName::kStyle, HtmlName::kTextarea
+  HtmlName::kCode, HtmlName::kPre, HtmlName::kScript, HtmlName::kStyle, HtmlName::kTextarea
 };
 
 bool IsSensitiveKeyword(HtmlName::Keyword keyword) {
diff --git a/pagespeed/kernel/html/collapse_whitespace_filter_test.cc b/pagespeed/kernel/html/collapse_whitespace_filter_test.cc
index abbc79ed8..5dcb16fe9 100644
--- a/pagespeed/kernel/html/collapse_whitespace_filter_test.cc
+++ b/pagespeed/kernel/html/collapse_whitespace_filter_test.cc
@@ -62,6 +62,12 @@ TEST_F(CollapseWhitespaceFilterTest, NewlineTakesPrecedence) {
                    "is good to see you</body>");
 }
 
+TEST_F(CollapseWhitespaceFilterTest, DoNotCollapseWithinCode) {
+  ValidateNoChanges("do_not_collapse_within_code",
+                    "<body><code>hello   world,   it\n"
+                    "    is good  to     see you   </code></body>");
+}
+
 TEST_F(CollapseWhitespaceFilterTest, DoNotCollapseWithinPre) {
   ValidateNoChanges("do_not_collapse_within_pre",
                     "<body><pre>hello   world,   it\n"


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services