Skip to main content

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 pedantic

nginx

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.

This filter changes how the page is structured or delivered, not its size, so the example shows a source diff rather than a byte or request reduction.

See the before and after, with the source diff →

Frequently asked questions

What does the pedantic filter do?
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.
Is pedantic enabled by default?
No. pedantic is not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name with EnableFilters.
How do I enable pedantic on Apache and nginx?
Add ModPagespeedEnableFilters pedantic on Apache or pagespeed EnableFilters pedantic; on nginx. On IIS, add pagespeed EnableFilters pedantic to pagespeed.config.

This page is drawn from the pedantic entry on HTML filters. Every filter in one table: PageSpeed filters.

Search