HTML minify: output void elements without trailing slashes
-
As the W3C Validation Service outputs many alert info messages about “Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.”…
Can you rewrite your HTML minify function to remove trailing slashes to void elements, as Autoptimize plugin has?
Autoptimize can be configured to output void elements without trailing slashes, by using a filter with the autoptimize_html_after_minify hook — like this:
add_filter( 'autoptimize_html_after_minify', function( $html ) { return str_replace( '/>', '>', $html ); } );
The page I need help with: [log in to see the link]
- The topic ‘HTML minify: output void elements without trailing slashes’ is closed to new replies.