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).