filter · HTML filters
Pedantic (pedantic)
- Category:
- HTML
- CoreFilters:
- No
- OptimizeForBandwidth:
- No
- Risk:
- Generally safe
Adds type="text/javascript" and type="text/css" attributes to <script> and <style> elements. This satisfies HTML4 validators. Not needed for HTML5, where these types are the defaults.
When to use it
- Not in CoreFilters: it runs only when you enable it by name.
- Risk rating on these docs: Generally safe.
Risks
The
HTML filters
page lists no specific risks for this filter.
If a page misbehaves with it, DisableFilters pedantic turns it off
for the scope you set it in.
Configuration
Enable it in the module configuration, at server, virtual-host or location scope:
Apache
ModPagespeedEnableFilters pedanticnginx
pagespeed EnableFilters pedantic;IIS (pagespeed.config)
pagespeed EnableFilters pedantic
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters.
Live example
Adds default type attributes to script and style tags that omit them.
In the example's capture the HTML document grows from 316 B to 355 B, so the example shows a source diff rather than a byte or request reduction.
Frequently asked questions
- What does the pedantic filter do?
- Adds
type="text/javascript"andtype="text/css"attributes to<script>and<style>elements. This satisfies HTML4 validators. Not needed for HTML5, where these types are the defaults. - Is pedantic enabled by default?
- No.
pedanticis not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name withEnableFilters. - How do I enable pedantic on Apache and nginx?
- Add
ModPagespeedEnableFilters pedanticon Apache orpagespeed EnableFilters pedantic;on nginx. On IIS, addpagespeed EnableFilters pedanticto pagespeed.config.
Related filters
- add_base_tag — Add base tag
- add_head — Add head
- add_ids — Add IDs
- add_instrumentation — Add instrumentation
- collapse_whitespace — Collapse whitespace
- combine_heads — Combine heads
- compute_statistics — Compute HTML statistics
- convert_meta_tags — Convert meta tags
This page is drawn from the pedantic entry on HTML filters. Every filter in one table: PageSpeed filters.