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_attributesnginx
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%
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>becausegetis the default method. - Is elide_attributes enabled by default?
- No.
elide_attributesis not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name withEnableFilters. - How do I enable elide_attributes on Apache and nginx?
- Add
ModPagespeedEnableFilters elide_attributeson Apache orpagespeed EnableFilters elide_attributes;on nginx. On IIS, addpagespeed EnableFilters elide_attributesto 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 elide_attributes entry on HTML filters. Every filter in one table: PageSpeed filters.