Pedantic
Configuration
The 'Pedantic' filter is enabled by specifying:
- Apache:
ModPagespeedEnableFilters pedantic
- Nginx:
pagespeed EnableFilters pedantic;
in the configuration file.
Description
The 'Pedantic' filter is used to make PageSpeed more HTML4 compliant. Some filters remove type attributes in style and script tags, which are required for HTML4 validation checks but not HTML5. This filter adds default types to script and style tags. Note that it will increase HTML size and thus possibly increase latency so use it only if you require HTML4 validation.
Operation
There are two cases where a type
attribute can be added. First, if
a <style>
tag does not have a type
attribute
then a type="text/css"
attribute will be added to
the style
tag. Second, if a <script>
tag does
not have a type
attribute then
a type="text/javascript"
attribute will be added to
the script
tag.
The expected method of using the pedantic filter is via a query parameter
such as: '?ModPagespeedFilters=+pedantic
'.
You can see the filter in action at www.modpagespeed.com
on
this example.
Requirements
The 'Pedantic' filter will not alter a page with an HTML5 DOCTYPE.
Risks
This filter is considered medium risk. It is safe for most pages, but could
possibly break scripts by adding text/javascript
to a tag if the
default mime type is something other than text/javascript
.