Skip to main content

filter · HTML filters

Elide attributes (elide_attributes)

Category:
HTML
CoreFilters:
No
OptimizeForBandwidth:
No
Risk:
Generally safe

Removes HTML attributes that are set to their default values. For example, <form method="get"> becomes <form> because get is the default method.

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 elide_attributes 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 elide_attributes

nginx

pagespeed EnableFilters elide_attributes;

IIS (pagespeed.config)

pagespeed EnableFilters elide_attributes

Scoping, ForbidFilters and the thresholds filters read: Choosing filters .

Live example

Removes attributes whose value is the browser default.

Measured on the demo page, original against optimized:

  • HTML size

    193 B → 182 B −6%

See the before and after, with the source diff →

Frequently asked questions

What does the elide_attributes filter do?
Removes HTML attributes that are set to their default values. For example, <form method="get"> becomes <form> because get is the default method.
Is elide_attributes enabled by default?
No. elide_attributes is not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name with EnableFilters.
How do I enable elide_attributes on Apache and nginx?
Add ModPagespeedEnableFilters elide_attributes on Apache or pagespeed EnableFilters elide_attributes; on nginx. On IIS, add pagespeed EnableFilters elide_attributes to pagespeed.config.

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

Search