"Fossies" - the Fresh Open Source Software Archive

Member "incubator-pagespeed-mod-1.14.36.1/html/doc/filter-quote-remove.html" (28 Feb 2020, 3281 Bytes) of package /linux/www/apache_httpd_modules/incubator-pagespeed-mod-1.14.36.1.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the incubator-pagespeed-mod-1.14.36.1.tar.gz project site itself.

Remove Quotes

Configuration

The 'Remove Quotes' filter is enabled by specifying:

Apache:
ModPagespeedEnableFilters remove_quotes
Nginx:
pagespeed EnableFilters remove_quotes;

in the configuration file.

Description

The quote removal filter eliminates unnecessary quotation marks (either "" or '') from HTML attributes. While required by the various HTML specifications, browsers permit their omission when the value of an attribute is composed of a certain subset of characters (alphanumerics and some punctuation characters).

Quote removal produces a modest savings in byte count on most pages. It may also benefit gzip compression by canonicalizing the textual representation of name=value pairs.

For example, if the HTML document looks like this:

<html>
  <head>
  </head>
  <body>
    <img src="BikeCrashIcn.png" align='left' alt="" border="0" width='70' height='30' >
  </body>
</html>

Then PageSpeed will rewrite it into:

<html>
  <head>
  </head>
  <body>
    <img src=BikeCrashIcn.png align=left alt="" border=0 width=70 height=30 >
  </body>
</html>

Example

You can see the filter in action at www.modpagespeed.com on this example.

Requirements

Only previously-quoted attributes are subject to quote removal. Quote removal occurs after most rewriting passes, so that any alterations to attribute values (such as rewritten URLs) will be correctly accounted for. This filter will act as a pass-through when XHTML is detected via doctype or content-type.

Risks

This filter is low risk. Space savings from the filter may be small (so the cost of running the filter may outweigh its benefits in certain settings).