• Resolved Insect Trojan

    (@insecttrojan)


    hello autoptimize cant remove my type=’text/javascript’ how can i fix it because the validator.w3.org says Warning: The type attribute is unnecessary for JavaScript resources. thanks a lot

    is this right ?

    // Remove ‘type’ attribute of scripts and styles

    if ( ! function_exists( ‘prefix_remove_type_attr’ ) ) {

    function prefix_remove_type_attr( $tag ) {
    return preg_replace( “/type=[‘\”]text\/(javascript|css)[‘\”]/”, ”, $tag );
    }

    add_filter( ‘style_loader_tag’, ‘prefix_remove_type_attr’, 10 );
    add_filter( ‘script_loader_tag’, ‘prefix_remove_type_attr’, 10 );
    add_filter( ‘autoptimize_html_after_minify’, ‘prefix_remove_type_attr’, 10 ); // ‘Autoptimize’ plugin support

    }

    • This topic was modified 3 years, 8 months ago by Insect Trojan.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    AO doesn’t add type attributes itself, so I suppose you’re talking about non-autoptimized resources. but the code snippet looks OK at first sight, yes ??

    frank

    Thread Starter Insect Trojan

    (@insecttrojan)

    yes i talking for non autoptimize resources. thanks a lot

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘type attributes’ is closed to new replies.